Skip to content

Commit

Permalink
bc_code init"
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaguy22 committed Sep 15, 2023
1 parent b504ca9 commit fa4efe2
Show file tree
Hide file tree
Showing 19 changed files with 977 additions and 273 deletions.
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.7.0] - 2023-03-24

### Added
- [32](https://github.com/OSC/bc_osc_codeserver/pull/32) Codeserver 4.8 support

### Removed
- - [32](https://github.com/OSC/bc_osc_codeserver/pull/32) Codeserver 3.4 selection

## [0.4.0] - 2021-08-16

### Added

- [20](https://github.com/OSC/bc_osc_codeserver/pull/20) add better support around
cpp extension, initializing a db on a local file system.

### Changed

- [19](https://github.com/OSC/bc_osc_codeserver/pull/19) changed the shebang of the
main script to `bash -l` so that modules and extra PATH settings get loaded from
a user's ~/.bashrc file.

## [0.3.0] - 2021-08-16

- entry missing!

## [0.2.0] - 2021-08-16

- entry missing!

## 0.1.0 - 2020-10-07
### Added
- Initial release of OSC Code Server.

[Unreleased]: https://github.com/OSC/bc_osc_codeserver/compare/v0.7.0...HEAD
[0.7.0]: https://github.com/OSC/bc_osc_codeserver/compare/v0.6.0...v0.7.0
[0.4.0]: https://github.com/OSC/bc_osc_codeserver/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/OSC/bc_osc_codeserver/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/OSC/bc_osc_codeserver/compare/v0.1.0...v0.2.0
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

86 changes: 82 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,86 @@
# Batch Connect - Jupyter
# Batch Connect - OSC Code Server

![GitHub Release](https://img.shields.io/github/release/osc/bc_osc_jupyter.svg)
![GitHub Release](https://img.shields.io/github/release/osc/bc_osc_codeserver.svg)
[![GitHub License](https://img.shields.io/badge/license-MIT-green.svg)](https://opensource.org/licenses/MIT)

An interactive app template designed for the BioHive Portal that launches a Jupyter
server.
An improved file viewer / editor for OSC OnDemand that launches a
Code Server within an Owens batch job. Code Server leverages VSCode as its
editor.

## Prerequisites

This Batch Connect app requires the following software be installed on the
**compute nodes** that the batch job is intended to run on (**NOT** the
OnDemand node):

- [Lmod] 6.0.1+ or any other `module purge` and `module load <modules>` based
CLI used to load appropriate environments within the batch job before
launching Code server.
- [Code Server] 2.x+ available from Github: https://github.com/cdr/code-server/releases

[Code Server]: https://coder.com/
[Lmod]: https://www.tacc.utexas.edu/research-development/tacc-projects/lmod
[VS Code]: https://code.visualstudio.com/

## Install

1. Use Git to clone this app and checkout the desired branch/version you want to
use and place this wherever you store batch connect apps (`/var/www/ood/apps/sys` or `~/ondemand/dev`):

```sh
scl enable git29 -- git clone <repo>
cd <dir>
scl enable git29 -- git checkout <tag/branch>
```

2. Deploy code-server on your systems.

```sh
# replace URL with latest release from code-server
wget https://github.com/cdr/code-server/releases/download/3.2.0/code-server-3.2.0-linux-x86_64.tar.gz
tar -xzf code-server-3.2.0-linux-x86_64.tar.gz
```

3. You will notice code-server is an executable inside that directory and can get the full path:

```sh
$ readlink -f code-server-3.2.0-linux-x86_64.tar.gz
/users/PZS0562/efranz/code-server-3.2.0-linux-x86_64.tar.gz
```

4. Update the path to the code-server binary in the script https://github.com/OSC/bc_osc_codeserver/blob/3082790ee69c82fe6fe757074da7d8d18c7d7e3d/template/script.sh.erb#L27:

```diff
# An arbitrary path...
- /fs/project/PZS0714/mrodgers/bin/code-server-2.1523-vsc1.38.1 \
+ /users/PZS0562/efranz/code-server-3.2.0-linux-x86_64/code-server \
--auth=password \
--port="$port" \
```

5. Update form.yml to use the correct cluster, and any other changes as necessary to form.yml or submit.yml that is appropriate for your cluster.

## Update

To update the app you would:

```sh
cd <dir>
scl enable git29 -- git fetch
scl enable git29 -- git checkout <tag/branch>
```

Again, you do not need to restart the app as it isn't a Passenger app.
## Known Issues
- In-app installation of extensions does not work
- The authentication provided by code-server is unencrypted
## Contributing
1. Fork it ( https://github.com/OSC/bc_osc_codeserver/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
6 changes: 6 additions & 0 deletions form.js

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions form.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,41 @@
}.map(&:name).grep(/^P./)
-%>
---
cluster:
- "slurm"
cluster: "slurm"
form:
- bc_queue
- mode
- cuda_version
- version
- bc_num_hours
- num_cores
- gpu_type
- num_gpus
- memory
- modules
- extra_jupyter_args
- bc_account
- bc_num_slots
- classroom
- account
- working_dir
- version
attributes:
cluster: "slurm"
modules: "python"
cuda_version: "cuda11.8/toolkit/11.8.0"
classroom: 0
version: "3.1"
bc_account: null
bc_num_slots: null
gpu_type:
label: GPU Type
widget: select
options:
- ["none", "none"]
- ["a100", "a100"]
- ["1080ti", "1080ti"]
- ["v100", "v100"]
class: "gpu-selection"
num_gpus:
widget: "number_field"
label: "Number of GPUS"
value: 0
required: true
help: "Specify the number of gpus for the job"
class: "gpu-count-field"
bc_queue:
label: Slurm Partition
widget: select
options:
- ["batch", "batch"]
- ["interactive", "interactive"]
- ["mem", "mem"]
extra_jupyter_args: ""
bc_num_hours:
widget: "number_field"
label: "Number of Hours"
Expand All @@ -58,11 +62,7 @@ attributes:
min: 1
max: 32
required: true
help: "Specify the amount of memory in MB. Min: 1GB - Max: 32GB"
mode:
widget: "radio"
value: "1"
options:
- ["Jupyter Lab", "1"]
- ["Jupyter Notebook", "0"]

help: "Specify the amount of memory in MB. Min: 2GB, Max: 32GB"
account: null
version: "4.9.1"
working_dir: null
Binary file modified icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions manifest.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
name: Jupyter Sandbox
name: Code Server
category: Interactive Apps
subcategory: Servers
subcategory: BioHive Applications
role: batch_connect
description: |
This app will launch a [Jupyter] server on the BioHive cluster.
[Jupyter]: https://jupyter.org/
This app will launch a VS Code server using Code Server on the BioHive cluster.
49 changes: 49 additions & 0 deletions packaging/ondemand-bc_osc_codeserver.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Disable debuginfo as it causes issues with bundled gems that build libraries
%global debug_package %{nil}
%global repo_name bc_osc_codeserver
%global app_name bc_osc_codeserver
%{!?package_version: %define package_version %{major}.%{minor}.%{patch}}
%{!?package_release: %define package_release 1}
%{!?git_tag: %define git_tag v%{package_version}}
%define git_tag_minus_v %(echo %{git_tag} | sed -r 's/^v//')

Name: ondemand-%{app_name}
Version: %{package_version}
Release: %{package_release}%{?dist}
Summary: Batch Connect - OSC Code Server

Group: System Environment/Daemons
License: MIT
URL: https://github.com/OSC/%{repo_name}
Source0: https://github.com/OSC/%{repo_name}/archive/%{git_tag}.tar.gz

Requires: ondemand

# Disable automatic dependencies as it causes issues with bundled gems and
# node.js packages used in the apps
AutoReqProv: no

%description
An interactive app designed for OSC OnDemand that launches a Code Server within an Owens batch job.


%prep
%setup -q -n %{repo_name}-%{git_tag_minus_v}


%build


%install
%__mkdir_p %{buildroot}%{_localstatedir}/www/ood/apps/sys/%{app_name}
%__cp -a ./. %{buildroot}%{_localstatedir}/www/ood/apps/sys/%{app_name}/
echo v%{version} > %{buildroot}%{_localstatedir}/www/ood/apps/sys/%{app_name}/VERSION


%files
%defattr(-,root,root)
%{_localstatedir}/www/ood/apps/sys/%{app_name}
%{_localstatedir}/www/ood/apps/sys/%{app_name}/manifest.yml


%changelog
79 changes: 0 additions & 79 deletions packaging/ondemand-bc_osc_jupyter.spec

This file was deleted.

5 changes: 4 additions & 1 deletion submit.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ script:
native:
- "--mem=<%= memory.blank? ? 2 : memory.to_i %>G"
- "--cpus-per-task=<%= num_cores.blank? ? 1 : num_cores.to_i %>"
- "<% if gpu_type == 'none' %>--gpus-per-node=<%= num_gpus.blank? ? 1 : num_gpus.to_i %><% else %>--gpus-per-node=<%= gpu_type %>:<%= num_gpus.blank? ? 1 : num_gpus.to_i %><% end %>"

batch_connect:
template: "basic"
template: "basic"
conn_params:
- code_server_version
12 changes: 6 additions & 6 deletions template/after.sh.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<% if context.cluster !~ /kubernetes/ -%>
# Wait for the Jupyter server to start
echo "Waiting for Jupyter server to open port ${port}..."
# Wait for the Code Server to start
echo "$(date): Waiting for Code Server to open port ${port}..."

if wait_until_port_used "${host}:${port}" 600; then
echo "Discovered Jupyter server listening on port ${port}!"
echo "$(date): Discovered code-server listening on port ${port}!"
else
echo "Timed out waiting for Jupyter server to open port ${port}!"
echo "$(date): Timed out waiting for Code Server to open port ${port}!"
clean_up 1
fi

sleep 2
<% end -%>
Binary file removed template/assets/julia/logo-32x32.png
Binary file not shown.
Binary file removed template/assets/julia/logo-64x64.png
Binary file not shown.
Binary file removed template/assets/python/logo-32x32.png
Binary file not shown.
Binary file removed template/assets/python/logo-64x64.png
Binary file not shown.
1 change: 0 additions & 1 deletion template/assets/pythonconda

This file was deleted.

Loading

0 comments on commit fa4efe2

Please sign in to comment.