Skip to content

Commit

Permalink
Merge pull request #210 from plasmabio/update-resource-monitoring
Browse files Browse the repository at this point in the history
Update resource monitoring in documentation
  • Loading branch information
jtpio authored Apr 15, 2022
2 parents 2d23aec + af70ebd commit d7d6703
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ volumes/
# the Ansible file
ansible/hosts*
ansible/users-config.yml
ansible/*.csv

# local TLJH config used for testing
config.yaml
32 changes: 22 additions & 10 deletions docs/configuration/batch-users.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
(batch-users)=

# Creating users in batches
# Creating and deleting users in batches

The {ref}`install-users` section details how to create the initial list of users.

However in some cases it is useful to have a more automated way to create (and delete) users
in batches. For example when preparing and cleaning up a group of students at the beginning and end of a semester.

This section details how to create users defined in a CSV file using Ansible Playbooks.
This section details how to create and delete users defined in a CSV file using Ansible Playbooks.

## Creating the CSV File

Expand All @@ -33,24 +33,19 @@ stu-megm1-10,QjhalcW9Uq5wxo,megm1
Since the fields in the CSV file are delimited by commas, passwords should not contain any `,` character.
````

## Running the playbooks
## Running the playbook to create users

To create the users, go to the `ansible/` folder and run the `student-create.yml` playbook with:

```sh
ansible-playbook student-create.yml -u ubuntu -e "studentdef=students.csv"
```

It is also possible to delete the users from the same CSV definition, using the `student-remove.yml` playbook:

```sh
ansible-playbook student-remove.yml -u ubuntu -e "studentdef=students.csv"
```

````{note}
It is possible to pass additional parameters when creating users in batches.
For example if you have a file defining disk quotas for a group of students:
For example if you have a file `students-config.yml` defining disk quotas for a group of students:
```yaml
# default quotas for students
Expand All @@ -61,7 +56,24 @@ quota:
You can run the playbook and reference that extra file:
```bash
```sh
ansible-playbook student-create.yml -u ubuntu -e "studentdef=students.csv" -e @students-config.yml
```
````


## Running the playbook to delete users

To delete users, go to the `ansible/` folder and run the `student-remove.yml` playbook with:

```sh
ansible-playbook student-remove.yml -u ubuntu -e "studentdef=students.csv"
```

````{warning}
You need to provide the exact same CSV file you used to create users in the first place.
````

````{warning}
Please note that user home directories are deleted.
````
16 changes: 7 additions & 9 deletions docs/configuration/resources.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Resources

Plasma provides default values to limit the Memory and CPU usage.
Plasma provides default values to limit the memory and CPU usage.

## Memory

Expand All @@ -19,7 +19,7 @@ Users can monitor their memory usage using the indicator in the top bar area if

## CPU

By default Plasma sets a limit of `2 cpus` for each user server.
By default Plasma sets a limit of `2 CPUs` for each user server.

This limit is enforced by the operating system, which throttles access to the CPU by the processes running in the
Docker container.
Expand All @@ -37,13 +37,11 @@ Users can monitor their CPU usage using the indicator in the top bar area if the

## Displaying the indicators

To enable the Memory and CPU indicators as shown above, the following dependencies must be added to the user environment:
To enable the memory and CPU indicators as shown above, the following dependencies must be added to the user environment:

- `nbresuse`
- `jupyterlab-topbar-extension`
- `jupyter-resource-usage`
- `jupyterlab-topbar`
- `jupyterlab-topbar-text`
- `jupyterlab-system-monitor`

As an example, checkout the following two links:

- [Adding nbresuse](https://github.com/plasmabio/template-python/blob/a4edf334c6b4b16be3a184d0d6e8196137ee1b06/environment.yml#L9)
- [Adding the JupyterLab extensions](https://github.com/plasmabio/template-python/blob/a4edf334c6b4b16be3a184d0d6e8196137ee1b06/postBuild#L4-L5)
As an example, checkout this [template](https://github.com/plasmabio/template-python/blob/master/binder/environment.yml) for a Python environment.

0 comments on commit d7d6703

Please sign in to comment.