Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout Fix & 404s #155

Merged
merged 8 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a94bf02
92d3b88
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ def get_resource_job(self, job):
if len(resource_job["errors"]):
raise APIException(resource_job["errors"])
resource_job = resource_job["jobs"][0]

if resource_job["job_state"] == "TIMEOUT":
logger.error(
f"Workspaces Job {job.id}/Slurm job {job.resource_job_id} has timed out."
)

resource_job["status"] = self.translate_status(resource_job["job_state"])
end_time = resource_job.get("end_time")
if end_time is not None:
Expand Down
2 changes: 1 addition & 1 deletion src/user_workspaces_server/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def update_job_status(job_id):

# TODO: At some point we will have metrics returned by resource_job_info
job.job_details["current_job_details"].update(
resource_job_info["current_job_details"]
resource_job_info.get("current_job_details", {})
)

if job.job_details["current_job_details"].get("connection_details", {}):
Expand Down
9 changes: 6 additions & 3 deletions src/user_workspaces_server/views/job_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ def get(self, request, job_id=None):

job = list(job.all().values(*models.Job.get_dict_fields()))

return JsonResponse(
{"message": "Successful.", "success": True, "data": {"jobs": job}}
)
if job:
return JsonResponse(
{"message": "Successful.", "success": True, "data": {"jobs": job}}
)
else:
raise NotFound("Job matching given parameters could not be found.")

def put(self, request, job_id, put_type):
try:
Expand Down
21 changes: 13 additions & 8 deletions src/user_workspaces_server/views/workspace_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ def get(self, request, workspace_id=None):

workspaces = list(workspace.all().values(*models.Workspace.get_dict_fields()))

return JsonResponse(
{
"message": "Successful.",
"success": True,
"data": {"workspaces": workspaces},
}
)
if workspaces:
return JsonResponse(
{
"message": "Successful.",
"success": True,
"data": {"workspaces": workspaces},
}
)
else:
raise NotFound("Workspace matching given parameters could not be found.")

def post(self, request):
try:
Expand All @@ -57,7 +60,9 @@ def post(self, request):
raise ParseError("Workspace details not JSON.")

request_workspace_details = {
"files": [file["name"] for file in workspace_details.get("files", [])],
"files": [
{"name": file["name"]} for file in workspace_details.get("files", [])
],
"symlinks": workspace_details.get("symlinks", []),
}

Expand Down