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 (
ForeignKey
toSession
) – Session (related name:feedback
)
Reverse relationships:
- Parameters:
feedbackuserobjectpermission (Reverse
ForeignKey
fromFeedbackUserObjectPermission
) – All feedback user object permissions of this feedback (related name ofcontent_object
)feedbackgroupobjectpermission (Reverse
ForeignKey
fromFeedbackGroupObjectPermission
) – All feedback group object permissions of this feedback (related name ofcontent_object
)download (Reverse
ForeignKey
fromDownload
) – 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 (
ForeignKey
toPermission
) – Permission (related name:feedbackgroupobjectpermission
)group (
ForeignKey
toGroup
) – Group (related name:feedbackgroupobjectpermission
)content_object (
ForeignKey
toFeedback
) – 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 (
ForeignKey
toPermission
) – Permission (related name:feedbackuserobjectpermission
)user (
ForeignKey
toUser
) – User (related name:feedbackuserobjectpermission
)content_object (
ForeignKey
toFeedback
) – Content object (related name:feedbackuserobjectpermission
)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- 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 – 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
history – The history of this Session
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 (
ForeignKey
toAuthToken
) – Auth token (related name:session
)
Reverse relationships:
- Parameters:
sessionuserobjectpermission (Reverse
ForeignKey
fromSessionUserObjectPermission
) – All session user object permissions of this session (related name ofcontent_object
)sessiongroupobjectpermission (Reverse
ForeignKey
fromSessionGroupObjectPermission
) – All session group object permissions of this session (related name ofcontent_object
)feedback (Reverse
ForeignKey
fromFeedback
) – All feedbacks of this session (related name ofsession
)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class Region(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
- save(*args, **kwargs)[source]¶
Save the session instance, starting or stopping the service if needed.
- Return type:
- 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¶
- 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:
- class grandchallenge.workstations.models.SessionGroupObjectPermission(id, permission, group, content_object)[source]¶
- Parameters:
id (AutoField) – Primary key: ID
Relationship fields:
- Parameters:
permission (
ForeignKey
toPermission
) – Permission (related name:sessiongroupobjectpermission
)group (
ForeignKey
toGroup
) – Group (related name:sessiongroupobjectpermission
)content_object (
ForeignKey
toSession
) – Content object (related name:sessiongroupobjectpermission
)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class grandchallenge.workstations.models.SessionUserObjectPermission(id, permission, user, content_object)[source]¶
- Parameters:
id (AutoField) – Primary key: ID
Relationship fields:
- Parameters:
permission (
ForeignKey
toPermission
) – Permission (related name:sessionuserobjectpermission
)user (
ForeignKey
toUser
) – User (related name:sessionuserobjectpermission
)content_object (
ForeignKey
toSession
) – 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 (
OneToOneField
toGroup
) – Editors group (related name:editors_of_workstation
)users_group (
OneToOneField
toGroup
) – Users group (related name:users_of_workstation
)config (
ForeignKey
toWorkstationConfig
) – Config (related name:workstation
)
Reverse relationships:
- Parameters:
phase (Reverse
ForeignKey
fromPhase
) – All phases of this workstation (related name ofworkstation
)algorithm (Reverse
ForeignKey
fromAlgorithm
) – All algorithms of this workstation (related name ofworkstation
)archive (Reverse
ForeignKey
fromArchive
) – All archives of this workstation (related name ofworkstation
)workstationuserobjectpermission (Reverse
ForeignKey
fromWorkstationUserObjectPermission
) – All workstation user object permissions of this workstation (related name ofcontent_object
)workstationgroupobjectpermission (Reverse
ForeignKey
fromWorkstationGroupObjectPermission
) – All workstation group object permissions of this workstation (related name ofcontent_object
)workstationimage (Reverse
ForeignKey
fromWorkstationImage
) – All workstation images of this workstation (related name ofworkstation
)readerstudy (Reverse
ForeignKey
fromReaderStudy
) – 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 (
ForeignKey
toPermission
) – Permission (related name:workstationgroupobjectpermission
)group (
ForeignKey
toGroup
) – Group (related name:workstationgroupobjectpermission
)content_object (
ForeignKey
toWorkstation
) – Content object (related name:workstationgroupobjectpermission
)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- class grandchallenge.workstations.models.WorkstationImage(*args, **kwargs)[source]¶
A
WorkstationImage
is a docker container image of a workstation.- Parameters:
workstation – A
Workstation
can 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
/mlab4d4c4142
will 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?
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
requires_gpu (BooleanField) – Requires gpu
desired_gpu_type (CharField) – Desired gpu type. If this image requires a GPU, what GPU type would it like to use?
requires_memory_gb (PositiveIntegerField) – Requires memory gb
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 (
ForeignKey
toUser
) – Creator (related name:workstationimage
)user_upload (
ForeignKey
toUserUpload
) – User upload (related name:workstationimage
)
Reverse relationships:
- Parameters:
workstationimageuserobjectpermission (Reverse
ForeignKey
fromWorkstationImageUserObjectPermission
) – All workstation image user object permissions of this workstation image (related name ofcontent_object
)workstationimagegroupobjectpermission (Reverse
ForeignKey
fromWorkstationImageGroupObjectPermission
) – All workstation image group object permissions of this workstation image (related name ofcontent_object
)session (Reverse
ForeignKey
fromSession
) – 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 (
ForeignKey
toPermission
) – Permission (related name:workstationimagegroupobjectpermission
)group (
ForeignKey
toGroup
) – Group (related name:workstationimagegroupobjectpermission
)content_object (
ForeignKey
toWorkstationImage
) – 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 (
ForeignKey
toPermission
) – Permission (related name:workstationimageuserobjectpermission
)user (
ForeignKey
toUser
) – User (related name:workstationimageuserobjectpermission
)content_object (
ForeignKey
toWorkstationImage
) – 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 (
ForeignKey
toPermission
) – Permission (related name:workstationuserobjectpermission
)user (
ForeignKey
toUser
) – User (related name:workstationuserobjectpermission
)content_object (
ForeignKey
toWorkstation
) – Content object (related name:workstationuserobjectpermission
)
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶