Workstations
Workstations are used to view, annotate and upload images to grand challenge.
A workstation admin is able to upload a WorkstationImage
, which is a docker container image.
A WorkstationImage
expose a http and, optionally, a websocket port.
A workstation user can then launch a workstation Session
for a particular WorkstationImage
.
When a new session is started, a new container instance of the selected WorkstationImage
is lauched on the docker host.
The connection to the container will be proxied, and only accessible to the user that created the session.
The proxy will map the http and websocket connections from the user to the running instance, which is mapped by the container hostname.
The container instance will have the users API token set in the environment, so that it is able to interact with the grand challenge API as this user.
The user is able to stop the container, otherwise it will be terminated after maxmium_duration
is reached.
- class grandchallenge.workstations.models.Feedback(id, created, modified, session, screenshot, user_comment, context)[source]
- Parameters
id (UUIDField) – Id
created (DateTimeField) – Created
modified (DateTimeField) – Modified
session (ForeignKey to
Session
) – Sessionscreenshot (ImageField) – Screenshot
user_comment (TextField) – User comment
context (JSONField) – Context
- exception DoesNotExist
- exception MultipleObjectsReturned
- save(*args, **kwargs)[source]
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- Return type
None
- class grandchallenge.workstations.models.Session(*args, **kwargs)[source]
Tracks who has launched workstation images. The
WorkstationImage
will be launched as aService
. TheSession
is responsible for starting and stopping theService
.- Parameters
status (PositiveSmallIntegerField) – Stores what has happened with the service, is it running, errored, etc?
region (CharField) – Stores which region this session runs in
creator (ForeignKey to
User
) – Who created the session? This is also the only user that should be able to access the launched service.workstation_image (ForeignKey to
WorkstationImage
) – The container image that will be launched by thisSession
.maximum_duration (DurationField) – The maximum time that the service can be active before it is terminated
user_finished (BooleanField) – Indicates if the user has chosen to end the session early
history – The history of this Session
id (UUIDField) – Id
created (DateTimeField) – Created
modified (DateTimeField) – Modified
auth_token (ForeignKey to
AuthToken
) – Auth tokenlogs (TextField) – Logs
ping_times (JSONField) – Ping times
- exception DoesNotExist
- exception MultipleObjectsReturned
- property environment: dict
- Return type
dict
- Returns
The environment variables that should be set on the container.
- property expires_at: datetime
- Return type
datetime
- Returns
The time when this session expires.
- property hostname: str
- Return type
str
- Returns
The unique hostname for this session
- save(*args, **kwargs)[source]
Save the session instance, starting or stopping the service if needed.
- Return type
None
- save_without_historical_record(*args, **kwargs)
Save model without saving a historical record
Make sure you know what you’re doing before you use this method.
- property service: Service
- Return type
Service
- Returns
The service for this session, could be active or inactive.
- start()[source]
Starts the service for this session, ensuring that the
workstation_image
is ready to be used and thatWORKSTATIONS_MAXIMUM_SESSIONS
has not been reached in this region.- Raises
ComponentException – If the service cannot be started.
- Return type
None
- stop()[source]
Stop the service for this session, cleaning up all of the containers.
- Return type
None
- property task_kwargs: dict
- Return type
dict
- Returns
The kwargs that need to be passed to celery to get this object
- update_status(*, status)[source]
Updates the status of this session.
- Parameters
status (((0, Queued), (1, Started), (2, Running), (3, Failed), (4, Stopped))) – The new status for this session.
- Return type
None
- property workstation_url: str
- Return type
str
- Returns
The url that users will use to access the workstation instance.
- class grandchallenge.workstations.models.Workstation(*args, **kwargs)[source]
Store the title and description of a workstation.
- Parameters
title (CharField) – Title
description (TextField) – Description
slug (AutoSlugField) – Slug
id (UUIDField) – Id
created (DateTimeField) – Created
modified (DateTimeField) – Modified
logo (JPEGField) – Logo
editors_group (OneToOneField to
Group
) – Editors groupusers_group (OneToOneField to
Group
) – Users groupconfig (ForeignKey to
WorkstationConfig
) – Configpublic (BooleanField) – Public. If True, all logged in users can use this viewer, otherwise, only the users group can use this viewer.
- exception DoesNotExist
- exception MultipleObjectsReturned
- latest_executable_image
- Returns
The most recent container image for this workstation
- save(*args, **kwargs)[source]
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- class grandchallenge.workstations.models.WorkstationImage(*args, **kwargs)[source]
A
WorkstationImage
is a docker container image of a workstation.- Parameters
workstation (ForeignKey to
Workstation
) – AWorkstation
can have multipleWorkstationImage
, that represent different versions of a workstationhttp_port (PositiveIntegerField) – This container will expose a http server on this port
websocket_port (PositiveIntegerField) – This container will expose a websocket on this port. Any relative url that starts with
/mlab4d4c4142
will be proxied to this port.initial_path (CharField) – The initial path that users will navigate to in order to load the workstation
id (UUIDField) – Id
created (DateTimeField) – Created
modified (DateTimeField) – Modified
creator (ForeignKey to
User
) – Creatoruser_upload (ForeignKey to
UserUpload
) – User uploadimage (FileField) – Image. .tar.xz archive of the container image produced from the command ‘docker save IMAGE | xz -T0 -c > IMAGE.tar.xz’. See https://docs.docker.com/engine/reference/commandline/save/
image_sha256 (CharField) – Image sha256
latest_shimmed_version (CharField) – Latest shimmed version
import_status (PositiveSmallIntegerField) – Import status
is_manifest_valid (BooleanField) – Is manifest valid. Is this image’s manifest valid?
is_in_registry (BooleanField) – Is in registry. Is this image in the container registry?
is_on_sagemaker (BooleanField) – Is on sagemaker. Does a SageMaker model for this image exist?
status (TextField) – Status
requires_gpu (BooleanField) – Requires gpu
requires_memory_gb (PositiveIntegerField) – Requires memory gb
- exception DoesNotExist
- exception MultipleObjectsReturned
- save(*args, **kwargs)[source]
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.