Skip to main content

A simple creator of machines with Jupyterlab

Project description

labmachine

This a POC about creating a jupyter instance on demand and registering it into a dns provider and HTTPS.

Right now only works for Google Cloud but should be easy expand to other providers.

For examples, see examples There you can see infra_[cpu|gpu].py and lab_[cpu|gpu].py

infra files are raw implementacion of the cluster library. lab files are abstractions built over this library for jupyter lab provisioning.

For authentication the google app cred variable should be defined:

./scripts/gce_auth_key.sh <ACCOUNT>@<PROJECT_ID>.iam.gserviceaccount.com
mv gce.json ${HOME}/.ssh/gce.json
export GOOGLE_APPLICATION_CREDENTIALS=${HOME}/.ssh/gce.json

Run gcloud iam service-accounts list to see SA available in your project.

Suggested approach:

If you don't have a SA already created, you can take this strategy to create one and asign permissions to it.

gcloud iam service-accounts create labcreator
    --description="Jupyter lab creator" \
    --display-name="lab-creator"

Then add the following roles to the account:

DNS role is needed only if the google dns provider is used

Warning: those roles can be too permissive, please check this for more information

roles="roles/compute.instanceAdmin.v1 roles/iam.serviceAccountUser"
for $perm in `cat $roles`; do
	gcloud projects add-iam-policy-binding PROJECT_ID \
  	  --member="serviceAccount:labcreator@PROJECT_ID.iam.gserviceaccount.com" \
    	--role=$perm
done

Destroy lab

python3 examples/destroy_lab.py

Next work

See https://trello.com/b/F2Smw3QO/labmachine

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

labmachine-0.2.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

labmachine-0.2.0-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

Details for the file labmachine-0.2.0.tar.gz.

File metadata

  • Download URL: labmachine-0.2.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.18.19_1

File hashes

Hashes for labmachine-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3666c530f7fb7678c06defb03c6f3b5018417eaf9c088b906efc1109a5ea8cea
MD5 305f3effdf796fac9d3e63ca459cfa4e
BLAKE2b-256 f4bee1bc35796f76397a39a2890fe6a7fcd697f86ab520780a589a2711ff6745

See more details on using hashes here.

File details

Details for the file labmachine-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: labmachine-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 39.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.10 Linux/5.18.19_1

File hashes

Hashes for labmachine-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 974a52cbee36a62508e3199c49038eb8477b38a461b826fbc9c2e9bb3d5cf03b
MD5 bdcea74fa769d911f7a88cfe171106d8
BLAKE2b-256 5b144b27f5aba049ff78af0732c31e21fe37d04c1ebd4d97d381b69d3ade5d58

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page