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) – Primary key: Id
created (DateTimeField) – Created
modified (DateTimeField) – Modified
screenshot (ImageField) – Screenshot
user_comment (TextField) – User comment
context (JSONField) – Context
Relationship fields:
- Parameters:
session (
ForeignKeytoSession) – Session (related name:feedback)
Reverse relationships:
- Parameters:
feedbackuserobjectpermission (Reverse
ForeignKeyfromFeedbackUserObjectPermission) – All feedback user object permissions of this feedback (related name ofcontent_object)feedbackgroupobjectpermission (Reverse
ForeignKeyfromFeedbackGroupObjectPermission) – All feedback group object permissions of this feedback (related name ofcontent_object)download (Reverse
ForeignKeyfromDownload) – All downloads of this feedback (related name offeedback)
- 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:
- class grandchallenge.workstations.models.FeedbackGroupObjectPermission(id, permission, group, content_object)[source]¶
- Parameters:
id (AutoField) – Primary key: ID
Relationship fields:
- Parameters:
permission (
ForeignKeytoPermission) – Permission (related name:feedbackgroupobjectpermission)group (
ForeignKeytoGroup) – Group (related name:feedbackgroupobjectpermission)content_object (
ForeignKeytoFeedback) – Content object (related name:feedbackgroupobjectpermission)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class grandchallenge.workstations.models.FeedbackUserObjectPermission(id, permission, user, content_object)[source]¶
- Parameters:
id (AutoField) – Primary key: ID
Relationship fields:
- Parameters:
permission (
ForeignKeytoPermission) – Permission (related name:feedbackuserobjectpermission)user (
ForeignKeytoUser) – User (related name:feedbackuserobjectpermission)content_object (
ForeignKeytoFeedback) – Content object (related name:feedbackuserobjectpermission)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class grandchallenge.workstations.models.Session(*args, **kwargs)[source]¶
Tracks who has launched workstation images. The
WorkstationImagewill be launched as aService. TheSessionis responsible for starting and stopping theService.- Parameters:
status – Stores what has happened with the service, is it running, errored, etc?
region – Stores which region this session runs in
creator – Who created the session? This is also the only user that should be able to access the launched service.
workstation_image – The container image that will be launched by this
Session.maximum_duration – The maximum time that the service can be active before it is terminated
user_finished – Indicates if the user has chosen to end the session early
id (UUIDField) – Primary key: Id
created (DateTimeField) – Created
modified (DateTimeField) – Modified
logs (TextField) – Logs
ping_times (JSONField) – Ping times
extra_env_vars (JSONField) – Extra env vars. Extra environment variables to include in this session
Relationship fields:
- Parameters:
auth_token (
ForeignKeytoAuthToken) – Auth token (related name:session)
Reverse relationships:
- Parameters:
sessionuserobjectpermission (Reverse
ForeignKeyfromSessionUserObjectPermission) – All session user object permissions of this session (related name ofcontent_object)sessiongroupobjectpermission (Reverse
ForeignKeyfromSessionGroupObjectPermission) – All session group object permissions of this session (related name ofcontent_object)feedback (Reverse
ForeignKeyfromFeedback) – All feedbacks of this session (related name ofsession)reader_studies (Reverse
ManyToManyFieldfromReaderStudy) – All reader studies of this session (related name ofworkstation_sessions)workstationsessionreaderstudy (Reverse
ForeignKeyfromWorkstationSessionReaderStudy) – All workstation session reader studys of this session (related name ofworkstation_session)session_utilization (Reverse
OneToOneFieldfromSessionUtilization) – The session utilization of this session (related name ofsession)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- save(*args, **kwargs)[source]¶
Save the session instance, starting or stopping the service if needed.
- Return type:
- property service: Service¶
- Returns:
The service for this session, could be active or inactive.
- start()[source]¶
Starts the service for this session, ensuring that the
workstation_imageis ready to be used and thatWORKSTATIONS_MAXIMUM_SESSIONShas not been reached in this region.- Raises:
ComponentException – If the service cannot be started.
- Return type:
- class grandchallenge.workstations.models.SessionGroupObjectPermission(id, permission, group, content_object)[source]¶
- Parameters:
id (AutoField) – Primary key: ID
Relationship fields:
- Parameters:
permission (
ForeignKeytoPermission) – Permission (related name:sessiongroupobjectpermission)group (
ForeignKeytoGroup) – Group (related name:sessiongroupobjectpermission)content_object (
ForeignKeytoSession) – Content object (related name:sessiongroupobjectpermission)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class grandchallenge.workstations.models.SessionManager(model=None, query=None, using=None, hints=None)[source]¶
- class grandchallenge.workstations.models.SessionUserObjectPermission(id, permission, user, content_object)[source]¶
- Parameters:
id (AutoField) – Primary key: ID
Relationship fields:
- Parameters:
permission (
ForeignKeytoPermission) – Permission (related name:sessionuserobjectpermission)user (
ForeignKeytoUser) – User (related name:sessionuserobjectpermission)content_object (
ForeignKeytoSession) – Content object (related name:sessionuserobjectpermission)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- 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) – Primary key: Id
created (DateTimeField) – Created
modified (DateTimeField) – Modified
logo (JPEGField) – Logo
public (BooleanField) – Public. If True, all logged in users can use this viewer, otherwise, only the users group can use this viewer.
Relationship fields:
- Parameters:
editors_group (
OneToOneFieldtoGroup) – Editors group (related name:editors_of_workstation)users_group (
OneToOneFieldtoGroup) – Users group (related name:users_of_workstation)config (
ForeignKeytoWorkstationConfig) – Config (related name:workstation)
Reverse relationships:
- Parameters:
phase (Reverse
ForeignKeyfromPhase) – All phases of this workstation (related name ofworkstation)algorithm (Reverse
ForeignKeyfromAlgorithm) – All algorithms of this workstation (related name ofworkstation)archive (Reverse
ForeignKeyfromArchive) – All archives of this workstation (related name ofworkstation)workstationuserobjectpermission (Reverse
ForeignKeyfromWorkstationUserObjectPermission) – All workstation user object permissions of this workstation (related name ofcontent_object)workstationgroupobjectpermission (Reverse
ForeignKeyfromWorkstationGroupObjectPermission) – All workstation group object permissions of this workstation (related name ofcontent_object)workstationimage (Reverse
ForeignKeyfromWorkstationImage) – All workstation images of this workstation (related name ofworkstation)readerstudy (Reverse
ForeignKeyfromReaderStudy) – All reader studies of this workstation (related name ofworkstation)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- property active_image¶
- Returns:
The desired image version for this workstation or None
- 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.WorkstationGroupObjectPermission(id, permission, group, content_object)[source]¶
- Parameters:
id (AutoField) – Primary key: ID
Relationship fields:
- Parameters:
permission (
ForeignKeytoPermission) – Permission (related name:workstationgroupobjectpermission)group (
ForeignKeytoGroup) – Group (related name:workstationgroupobjectpermission)content_object (
ForeignKeytoWorkstation) – Content object (related name:workstationgroupobjectpermission)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class grandchallenge.workstations.models.WorkstationImage(*args, **kwargs)[source]¶
A
WorkstationImageis a docker container image of a workstation.- Parameters:
workstation – A
Workstationcan have multipleWorkstationImage, that represent different versions of a workstationhttp_port – This container will expose a http server on this port
websocket_port – This container will expose a websocket on this port. Any relative url that starts with
/mlab4d4c4142will be proxied to this port.initial_path – The initial path that users will navigate to in order to load the workstation
id (UUIDField) – Primary key: Id
created (DateTimeField) – Created
modified (DateTimeField) – Modified
image (FileField) – Image. .tar.gz archive of the container image produced from the command ‘docker save IMAGE | gzip -c > IMAGE.tar.gz’. 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_removed (BooleanField) – Is removed. If this image has been removed then it has been removed from storage and cannot be activated
status (TextField) – Status
size_in_storage (PositiveBigIntegerField) – Size in storage. The number of bytes stored in the storage backend
size_in_registry (PositiveBigIntegerField) – Size in registry. The number of bytes stored in the registry
comment (TextField) – Comment. Add any information (e.g. version ID) about this image here.
is_desired_version (BooleanField) – Is desired version
Relationship fields:
- Parameters:
creator (
ForeignKeytoUser) – Creator (related name:workstationimage)user_upload (
ForeignKeytoUserUpload) – User upload (related name:workstationimage)
Reverse relationships:
- Parameters:
workstationimageuserobjectpermission (Reverse
ForeignKeyfromWorkstationImageUserObjectPermission) – All workstation image user object permissions of this workstation image (related name ofcontent_object)workstationimagegroupobjectpermission (Reverse
ForeignKeyfromWorkstationImageGroupObjectPermission) – All workstation image group object permissions of this workstation image (related name ofcontent_object)session (Reverse
ForeignKeyfromSession) – All sessions of this workstation image (related name ofworkstation_image)
- 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.
- class grandchallenge.workstations.models.WorkstationImageGroupObjectPermission(id, permission, group, content_object)[source]¶
- Parameters:
id (AutoField) – Primary key: ID
Relationship fields:
- Parameters:
permission (
ForeignKeytoPermission) – Permission (related name:workstationimagegroupobjectpermission)group (
ForeignKeytoGroup) – Group (related name:workstationimagegroupobjectpermission)content_object (
ForeignKeytoWorkstationImage) – Content object (related name:workstationimagegroupobjectpermission)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class grandchallenge.workstations.models.WorkstationImageUserObjectPermission(id, permission, user, content_object)[source]¶
- Parameters:
id (AutoField) – Primary key: ID
Relationship fields:
- Parameters:
permission (
ForeignKeytoPermission) – Permission (related name:workstationimageuserobjectpermission)user (
ForeignKeytoUser) – User (related name:workstationimageuserobjectpermission)content_object (
ForeignKeytoWorkstationImage) – Content object (related name:workstationimageuserobjectpermission)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class grandchallenge.workstations.models.WorkstationUserObjectPermission(id, permission, user, content_object)[source]¶
- Parameters:
id (AutoField) – Primary key: ID
Relationship fields:
- Parameters:
permission (
ForeignKeytoPermission) – Permission (related name:workstationuserobjectpermission)user (
ForeignKeytoUser) – User (related name:workstationuserobjectpermission)content_object (
ForeignKeytoWorkstation) – Content object (related name:workstationuserobjectpermission)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶