Skip to content
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
37 changes: 20 additions & 17 deletions client/modules/_hooks/src/workspace/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ export type TAppFileInput = {
targetPath?: string;
};

type TAppNotes = {
label?: string;
shortLabel?: string;
helpUrl?: string;
category?: string;
isInteractive?: boolean;
hideNodeCountAndCoresPerNode?: boolean;
icon?: string;
dynamicExecSystems?: string[];
queueFilter?: string[];
hideQueue?: boolean;
hideAllocation?: boolean;
hideMaxMinutes?: boolean;
jobLaunchDescription?: string;
showReservation?: boolean;
showTargetPath?: boolean;
};

export type TTapisApp = {
sharedAppCtx: string;
isPublic: boolean;
Expand Down Expand Up @@ -111,22 +129,7 @@ export type TTapisApp = {
tags: string[];
};
tags: string[];
notes: {
label?: string;
shortLabel?: string;
helpUrl?: string;
category?: string;
isInteractive?: boolean;
hideNodeCountAndCoresPerNode?: boolean;
icon?: string;
dynamicExecSystems?: string[];
queueFilter?: string[];
hideQueue?: boolean;
hideAllocation?: boolean;
hideMaxMinutes?: boolean;
jobLaunchDescription?: string;
showReservation?: boolean;
};
notes: TAppNotes;
uuid: string;
deleted: boolean;
created: string;
Expand Down Expand Up @@ -183,7 +186,7 @@ export type TTapisJob = {
mpiCmd?: string;
name: string;
nodeCount: number;
notes: string;
notes: TAppNotes;
owner: string;
parameterSet: string;
remoteChecksFailed: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,12 @@ export const JobsDetailModal: React.FC<{ uuid: string }> = ({ uuid }) => {
<dt>Job UUID: </dt>
<dd>{jobData.uuid}</dd>
<dt>Application: </dt>
<dd>{JSON.parse(jobData.notes).label || jobData.appId}</dd>
<dd>
{(typeof jobData.notes === 'string'
? JSON.parse(jobData.notes)
: jobData.notes
).label || jobData.appId}
</dd>
<dt>System: </dt>
<dd>{jobData.execSystemId}</dd>
</dl>
Expand Down
16 changes: 15 additions & 1 deletion designsafe/apps/workspace/api/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Workspace API Utils"""

import json
from typing import Union
from tapipy.tapis import TapisResult


def get_tapis_timeout_error_messages(job_id):
Expand All @@ -11,14 +13,26 @@ def get_tapis_timeout_error_messages(job_id):
]


def _get_job_notes(job_notes: Union[str, TapisResult]):
"""
Normalize `job.notes` as in older version of Tapis `notes` is a JSON-formatted string
but this is being changed to a TapisResult object. Once all tenants are migrated to
return structured (non-string) 'notes', this can be
removed
"""
if isinstance(job_notes, str):
return json.loads(job_notes)
return job_notes


def check_job_for_timeout(job):
"""
Check an interactive job for timeout status and mark it as finished
since Tapis does not have native support for interactive jobs yet
"""

if hasattr(job, "notes"):
notes = json.loads(job.notes)
notes = _get_job_notes(job.notes)

is_failed = job.status == "FAILED"
is_interactive = notes.get("isInteractive", False)
Expand Down