app/grandchallenge/workspaces/tasks.py
def wait_for_workspace_to_start(self, *, workspace_pk):
    """Checks if the workspace is up for up to 10 minutes."""
    workspace = Workspace.objects.get(pk=workspace_pk)

    if workspace.status != WorkspaceStatus.PENDING:
        # Nothing to do
        return

    with requests.Session() as s:
        _authorise(client=s, auth=workspace.user.workbench_token)

        instance = _get_workspace(
            s, workspace_id=workspace.service_workbench_id
        )

        if instance["status"] == WorkspaceStatus.PENDING:
            # Raises celery.exceptions.Retry
            self.retry(countdown=30)
            # TODO catch MaxRetriesExceeded?
        else:
            workspace.status = instance["status"]
            workspace.full_clean()
            workspace.save()
Checks if the workspace is up for up to 10 minutes.
Checks if the workspace is up for up to 10 minutes.
Checks if the workspace is up for up to 10 minutes .
def wait_for_workspace_to_start(self, *, workspace_pk):
    workspace = Workspace.objects.get(pk=workspace_pk)
    if workspace.status != WorkspaceStatus.PENDING:
        return
    with requests.Session() as s:
        _authorise(client=s, auth=workspace.user.workbench_token)
        instance = _get_workspace(
            s, workspace_id=workspace.service_workbench_id
        )
        if instance["status"] == WorkspaceStatus.PENDING:
            self.retry(countdown=30)
        else:
            workspace.status = instance["status"]
            workspace.full_clean()
            workspace.save()
def wait_for_workspace_to_start ( self , * , workspace_pk ) : workspace = Workspace . objects . get ( pk = workspace_pk ) if workspace . status != WorkspaceStatus . PENDING : return with requests . Session ( ) as s : _authorise ( client = s , auth = workspace . user . workbench_token ) instance = _get_workspace ( s , workspace_id = workspace . service_workbench_id ) if instance [ "status" ] == WorkspaceStatus . PENDING : self . retry ( countdown = 30 ) else : workspace . status = instance [ "status" ] workspace . full_clean ( ) workspace . save ( )
Checks if the workspace is up for up to 10 minutes.
Checks if the workspace is up for up to 10 minutes .
"""Checks if the workspace is up for up to 10 minutes.""" # Nothing to do # Raises celery.exceptions.Retry # TODO catch MaxRetriesExceeded?
self
workspace_pk