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:

Relationship fields:

Parameters:

session (ForeignKey to Session) – Session (related name: feedback)

Reverse relationships:

Parameters:
  • feedbackuserobjectpermission (Reverse ForeignKey from FeedbackUserObjectPermission) – All feedback user object permissions of this feedback (related name of content_object)

  • feedbackgroupobjectpermission (Reverse ForeignKey from FeedbackGroupObjectPermission) – All feedback group object permissions of this feedback (related name of content_object)

  • download (Reverse ForeignKey from Download) – All downloads of this feedback (related name of feedback)

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.FeedbackGroupObjectPermission(id, permission, group, content_object)[source]
Parameters:

id (AutoField) – Primary key: ID

Relationship fields:

Parameters:
  • permission (ForeignKey to Permission) – Permission (related name: feedbackgroupobjectpermission)

  • group (ForeignKey to Group) – Group (related name: feedbackgroupobjectpermission)

  • content_object (ForeignKey to Feedback) – 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 to Permission) – Permission (related name: feedbackuserobjectpermission)

  • user (ForeignKey to User) – User (related name: feedbackuserobjectpermission)

  • content_object (ForeignKey to Feedback) – 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 a ECSService.

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

  • host_address (GenericIPAddressField) – Host address. The IP address of the host this session is running on

  • task_arn (CharField) – Task arn

  • http_port (PositiveIntegerField) – Http port. The mapped port for http traffic on the host

  • websocket_port (PositiveIntegerField) – Websocket port. The mapped port for websocket traffic on the host

  • 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 to AuthToken) – Auth token (related name: session)

Reverse relationships:

Parameters:
  • sessionuserobjectpermission (Reverse ForeignKey from SessionUserObjectPermission) – All session user object permissions of this session (related name of content_object)

  • sessiongroupobjectpermission (Reverse ForeignKey from SessionGroupObjectPermission) – All session group object permissions of this session (related name of content_object)

  • feedback (Reverse ForeignKey from Feedback) – All feedbacks of this session (related name of session)

  • reader_studies (Reverse ManyToManyField from ReaderStudy) – All reader studies of this session (related name of workstation_sessions)

  • workstationsessionreaderstudy (Reverse ForeignKey from WorkstationSessionReaderStudy) – All workstation session reader studys of this session (related name of workstation_session)

  • session_utilization (Reverse OneToOneField from SessionUtilization) – The session utilization of this session (related name of session)

exception DoesNotExist
exception MultipleObjectsReturned
class Region(*values)[source]
clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

property environment: dict
Returns:

The environment variables that should be set on the container.

property expires_at: datetime
Returns:

The time when this session expires.

save(*args, **kwargs)[source]

Save the session instance, starting or stopping the service if needed.

Return type:

None

property task_kwargs: dict
Returns:

The kwargs that need to be passed to celery to get this object

property workstation_url: str
Returns:

The url that users will use to access the workstation instance.

class grandchallenge.workstations.models.SessionGroupObjectPermission(id, permission, group, content_object)[source]
Parameters:

id (AutoField) – Primary key: ID

Relationship fields:

Parameters:
  • permission (ForeignKey to Permission) – Permission (related name: sessiongroupobjectpermission)

  • group (ForeignKey to Group) – Group (related name: sessiongroupobjectpermission)

  • content_object (ForeignKey to Session) – 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 (ForeignKey to Permission) – Permission (related name: sessionuserobjectpermission)

  • user (ForeignKey to User) – User (related name: sessionuserobjectpermission)

  • content_object (ForeignKey to Session) – 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:

Relationship fields:

Parameters:
  • editors_group (OneToOneField to Group) – Editors group (related name: editors_of_workstation)

  • users_group (OneToOneField to Group) – Users group (related name: users_of_workstation)

  • config (ForeignKey to WorkstationConfig) – Config (related name: workstation)

Reverse relationships:

Parameters:
  • phase (Reverse ForeignKey from Phase) – All phases of this workstation (related name of workstation)

  • algorithm (Reverse ForeignKey from Algorithm) – All algorithms of this workstation (related name of workstation)

  • archive (Reverse ForeignKey from Archive) – All archives of this workstation (related name of workstation)

  • workstationuserobjectpermission (Reverse ForeignKey from WorkstationUserObjectPermission) – All workstation user object permissions of this workstation (related name of content_object)

  • workstationgroupobjectpermission (Reverse ForeignKey from WorkstationGroupObjectPermission) – All workstation group object permissions of this workstation (related name of content_object)

  • workstationimage (Reverse ForeignKey from WorkstationImage) – All workstation images of this workstation (related name of workstation)

  • readerstudy (Reverse ForeignKey from ReaderStudy) – All reader studies of this workstation (related name of workstation)

exception DoesNotExist
exception MultipleObjectsReturned
property active_image[source]
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 to Permission) – Permission (related name: workstationgroupobjectpermission)

  • group (ForeignKey to Group) – Group (related name: workstationgroupobjectpermission)

  • content_object (ForeignKey to Workstation) – 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.

The workstation must implement an http server on COMPONENTS_SERVICE_CONTAINER_HTTP_PORT, and can implement an http/websocket server on COMPONENTS_SERVICE_CONTAINER_WEBSOCKET_PORT. Any url path that contains mlab4d4c4142 will be proxied to COMPONENTS_SERVICE_CONTAINER_WEBSOCKET_PORT.

Parameters:
  • workstation – A Workstation can have multiple WorkstationImage, that represent different versions of a workstation

  • 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/

  • api_method (CharField) – Api method

  • 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 (ForeignKey to User) – Creator (related name: workstationimage)

  • user_upload (ForeignKey to UserUpload) – User upload (related name: workstationimage)

Reverse relationships:

Parameters:
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 to Permission) – Permission (related name: workstationimagegroupobjectpermission)

  • group (ForeignKey to Group) – Group (related name: workstationimagegroupobjectpermission)

  • content_object (ForeignKey to WorkstationImage) – 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 to Permission) – Permission (related name: workstationimageuserobjectpermission)

  • user (ForeignKey to User) – User (related name: workstationimageuserobjectpermission)

  • content_object (ForeignKey to WorkstationImage) – 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 to Permission) – Permission (related name: workstationuserobjectpermission)

  • user (ForeignKey to User) – User (related name: workstationuserobjectpermission)

  • content_object (ForeignKey to Workstation) – Content object (related name: workstationuserobjectpermission)

exception DoesNotExist
exception MultipleObjectsReturned
grandchallenge.workstations.models.delete_workstation_groups_hook(*_, instance, using, **__)[source]

Deletes the related groups.

We use a signal rather than overriding delete() to catch usages of bulk_delete.