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

task/WP-100: Display all jobAttributes via getJobDisplayInformation #868

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
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ function JobHistoryContent({
const outputDataObj = {
'Job Name': jobName,
'Output Location': outputLocation,
'Archive System': jobDetails.archiveSystemId,
'Archive Directory': jobDetails.archiveSystemDir,
};

const resubmitJob = () => {
Expand Down
16 changes: 16 additions & 0 deletions client/src/redux/sagas/fixtures/appdetail.fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ const appDetailFixture = {
inputMode: 'REQUIRED',
notes: { fieldType: 'number' },
},
{
arg: 'OpenSeesSP',
name: 'mainProgram',
description: '',
inputMode: 'FIXED',
notes: { isHidden: true },
},
],
containerArgs: [],
schedulerOptions: [
Expand All @@ -86,6 +93,15 @@ const appDetailFixture = {
sourceUrl: null,
targetPath: 'in.txt',
},
{
name: 'hello world',
description: 'hello world description',
inputMode: 'FIXED',
autoMountLocal: true,
sourceUrl: null,
targetPath: '.',
notes: { isHidden: true },
},
],
fileInputArrays: [],
nodeCount: 1,
Expand Down
4 changes: 2 additions & 2 deletions client/src/redux/sagas/fixtures/jobdetail.fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ const jobDetailFixture = {
memoryMB: 100,
maxMinutes: 10,
fileInputs:
'[{"name": "File to modify", "optional": true, "sourceUrl": "tapis://test.community/system/1/user/test/in.txt", "targetPath": "in.txt", "description": "The full greeting will be appended to the target .txt file", "autoMountLocal": true, "srcSharedAppCtx": false, "destSharedAppCtx": true}]',
'[{"name": "File to modify", "optional": true, "sourceUrl": "tapis://test.community/system/1/user/test/in.txt", "targetPath": "in.txt", "description": "The full greeting will be appended to the target .txt file", "autoMountLocal": true, "srcSharedAppCtx": false, "destSharedAppCtx": true}, {"name": "hello world", "optional": false, "sourceUrl": "", "targetPath": ".", "description": "hello world description", "autoMountLocal": true, "srcSharedAppCtx": false, "destSharedAppCtx": true, "notes": "{\\"isHidden\\":\\"true\\"}"}]',
parameterSet:
'{"appArgs": [{"arg": "hello", "name": "Greeting", "notes": "{\\"enum_values\\":[{\\"hello\\":\\"Hello\\"},{\\"hola\\":\\"Hola\\"},{\\"wassup\\":\\"Wassup\\"}]}", "include": null, "description": "Choose a greeting to give to your target"}, {"arg": "world", "name": "Target", "notes": "{}", "include": null, "description": "Whom to address your greeting"}, {"arg": "1", "name": "Sleep Time", "notes": "{\\"fieldType\\":\\"number\\"}", "include": null, "description": "How long to sleep before app execution"}], "envVariables": [{"key": "_tapisAppId", "value": "hello-world", "description": null}, {"key": "_tapisAppVersion", "value": "0.0.1", "description": null}, {"key": "_tapisArchiveOnAppError", "value": "true", "description": null}, {"key": "_tapisArchiveSystemDir", "value": "/home/user/tapis-jobs-archive/2023-01-24Z/hello-world_2023-01-24T23:52:57-e929ad16-adc5-4bd4-b84f-d41d1b67e5ee-007", "description": null}, {"key": "_tapisArchiveSystemId", "value": "cloud.data", "description": null}, {"key": "_tapisCoresPerNode", "value": "1", "description": null}, {"key": "_tapisDynamicExecSystem", "value": "false", "description": null}, {"key": "_tapisEffectiveUserId", "value": "user", "description": null}, {"key": "_tapisExecSystemExecDir", "value": "/scratch1/12345/user/tapis/e929ad16-adc5-4bd4-b84f-d41d1b67e5ee-007", "description": null}, {"key": "_tapisExecSystemHPCQueue", "value": "development", "description": null}, {"key": "_tapisExecSystemId", "value": "frontera", "description": null}, {"key": "_tapisExecSystemInputDir", "value": "/scratch1/12345/user/tapis/e929ad16-adc5-4bd4-b84f-d41d1b67e5ee-007", "description": null}, {"key": "_tapisExecSystemLogicalQueue", "value": "development", "description": null}, {"key": "_tapisExecSystemOutputDir", "value": "/scratch1/12345/user/tapis/e929ad16-adc5-4bd4-b84f-d41d1b67e5ee-007/output", "description": null}, {"key": "_tapisJobCreateDate", "value": "2023-01-24Z", "description": null}, {"key": "_tapisJobCreateTime", "value": "23:53:10.922143633Z", "description": null}, {"key": "_tapisJobCreateTimestamp", "value": "2023-01-24T23:53:10.922143633Z", "description": null}, {"key": "_tapisJobName", "value": "hello-world_2023-01-24T23:52:57", "description": null}, {"key": "_tapisJobOwner", "value": "user", "description": null}, {"key": "_tapisJobUUID", "value": "e929ad16-adc5-4bd4-b84f-d41d1b67e5ee-007", "description": null}, {"key": "_tapisJobWorkingDir", "value": "/scratch1/12345/user/tapis/e929ad16-adc5-4bd4-b84f-d41d1b67e5ee-007", "description": null}, {"key": "_tapisMaxMinutes", "value": "10", "description": null}, {"key": "_tapisMemoryMB", "value": "100", "description": null}, {"key": "_tapisNodes", "value": "1", "description": null}, {"key": "_tapisSysBatchScheduler", "value": "SLURM", "description": null}, {"key": "_tapisSysHost", "value": "frontera.tacc.utexas.edu", "description": null}, {"key": "_tapisSysRootDir", "value": "/", "description": null}, {"key": "_tapisTenant", "value": "portals", "description": null}, {"key": "_webhook_base_url", "value": "https://dev.a2cps.tacc.utexas.edu/webhooks/", "description": null}], "archiveFilter": {"excludes": [], "includes": [], "includeLaunchFiles": true}, "containerArgs": [], "schedulerOptions": [{"arg": "--tapis-profile tacc", "name": "tacc Scheduler Profile", "notes": "{}", "include": null, "description": "Scheduler profile for HPC clusters at TACC"}, {"arg": "-A TACC-ACI", "name": "TACC Allocation", "notes": null, "include": true, "description": "The allocation associated with this job execution"}]}',
'{"appArgs": [{"arg": "hello", "name": "Greeting", "notes": "{\\"enum_values\\":[{\\"hello\\":\\"Hello\\"},{\\"hola\\":\\"Hola\\"},{\\"wassup\\":\\"Wassup\\"}]}", "include": null, "description": "Choose a greeting to give to your target"}, {"arg": "world", "name": "Target", "notes": "{}", "include": null, "description": "Whom to address your greeting"}, {"arg": "1", "name": "Sleep Time", "notes": "{\\"fieldType\\":\\"number\\"}", "include": null, "description": "How long to sleep before app execution"}, {"arg": "OpenSeesSP", "name": "mainProgram", "notes": "{\\"isHidden\\":\\"true\\"}", "include": null, "description": "null"}, {"arg": "OpenSeesSP", "name": "_mainProgram", "include": null, "description": "null"}], "envVariables": [{"key": "_tapisAppId", "value": "hello-world", "description": null}, {"key": "_tapisAppVersion", "value": "0.0.1", "description": null}, {"key": "_tapisArchiveOnAppError", "value": "true", "description": null}, {"key": "_tapisArchiveSystemDir", "value": "/home/user/tapis-jobs-archive/2023-01-24Z/hello-world_2023-01-24T23:52:57-e929ad16-adc5-4bd4-b84f-d41d1b67e5ee-007", "description": null}, {"key": "_tapisArchiveSystemId", "value": "cloud.data", "description": null}, {"key": "_tapisCoresPerNode", "value": "1", "description": null}, {"key": "_tapisDynamicExecSystem", "value": "false", "description": null}, {"key": "_tapisEffectiveUserId", "value": "user", "description": null}, {"key": "_tapisExecSystemExecDir", "value": "/scratch1/12345/user/tapis/e929ad16-adc5-4bd4-b84f-d41d1b67e5ee-007", "description": null}, {"key": "_tapisExecSystemHPCQueue", "value": "development", "description": null}, {"key": "_tapisExecSystemId", "value": "frontera", "description": null}, {"key": "_tapisExecSystemInputDir", "value": "/scratch1/12345/user/tapis/e929ad16-adc5-4bd4-b84f-d41d1b67e5ee-007", "description": null}, {"key": "_tapisExecSystemLogicalQueue", "value": "development", "description": null}, {"key": "_tapisExecSystemOutputDir", "value": "/scratch1/12345/user/tapis/e929ad16-adc5-4bd4-b84f-d41d1b67e5ee-007/output", "description": null}, {"key": "_tapisJobCreateDate", "value": "2023-01-24Z", "description": null}, {"key": "_tapisJobCreateTime", "value": "23:53:10.922143633Z", "description": null}, {"key": "_tapisJobCreateTimestamp", "value": "2023-01-24T23:53:10.922143633Z", "description": null}, {"key": "_tapisJobName", "value": "hello-world_2023-01-24T23:52:57", "description": null}, {"key": "_tapisJobOwner", "value": "user", "description": null}, {"key": "_tapisJobUUID", "value": "e929ad16-adc5-4bd4-b84f-d41d1b67e5ee-007", "description": null}, {"key": "_tapisJobWorkingDir", "value": "/scratch1/12345/user/tapis/e929ad16-adc5-4bd4-b84f-d41d1b67e5ee-007", "description": null}, {"key": "_tapisMaxMinutes", "value": "10", "description": null}, {"key": "_tapisMemoryMB", "value": "100", "description": null}, {"key": "_tapisNodes", "value": "1", "description": null}, {"key": "_tapisSysBatchScheduler", "value": "SLURM", "description": null}, {"key": "_tapisSysHost", "value": "frontera.tacc.utexas.edu", "description": null}, {"key": "_tapisSysRootDir", "value": "/", "description": null}, {"key": "_tapisTenant", "value": "portals", "description": null}, {"key": "_webhook_base_url", "value": "https://dev.a2cps.tacc.utexas.edu/webhooks/", "description": null}], "archiveFilter": {"excludes": [], "includes": [], "includeLaunchFiles": true}, "containerArgs": [], "schedulerOptions": [{"arg": "--tapis-profile tacc", "name": "tacc Scheduler Profile", "notes": "{}", "include": null, "description": "Scheduler profile for HPC clusters at TACC"}, {"arg": "-A TACC-ACI", "name": "TACC Allocation", "notes": null, "include": true, "description": "The allocation associated with this job execution"}]}',
execSystemConstraints: null,
subscriptions: '[]',
blockedCount: 0,
Expand Down
68 changes: 23 additions & 45 deletions client/src/utils/jobsUtil.js
shayanaijaz marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -59,29 +59,34 @@ export function getAllocatonFromDirective(directive) {
* Get display values from job, app and execution system info
*/
export function getJobDisplayInformation(job, app) {
const fileInputs = JSON.parse(job.fileInputs);
const filterHiddenObjects = (objects) =>
objects
.filter((obj) => {
const notes = obj.notes ? JSON.parse(obj.notes) : null;
return !notes || !notes.isHidden;
})
.filter((obj) => !(obj.name || obj.sourceUrl || '').startsWith('_'));

const fileInputs = filterHiddenObjects(JSON.parse(job.fileInputs));
const parameterSet = JSON.parse(job.parameterSet);
const parameters = parameterSet.appArgs;
const parameters = filterHiddenObjects(parameterSet.appArgs);

const envVariables = parameterSet.envVariables;
const schedulerOptions = parameterSet.schedulerOptions;
const display = {
applicationName: job.appId,
systemName: job.execSystemId,
inputs: fileInputs
.map((input) => ({
label: input.name || 'Unnamed Input',
id: input.sourceUrl,
value: input.sourceUrl,
}))
.filter((obj) => !obj.id?.startsWith('_')),

parameters: parameters
.map((parameter) => ({
label: parameter.name,
id: parameter.name,
value: parameter.arg,
}))
.filter((obj) => !obj.id.startsWith('_')),
inputs: fileInputs.map((input) => ({
label: input.name || 'Unnamed Input',
id: input.sourceUrl,
value: input.sourceUrl,
})),

parameters: parameters.map((parameter) => ({
label: parameter.name,
id: parameter.name,
value: parameter.arg,
})),
};

if (app) {
Expand All @@ -96,34 +101,6 @@ export function getJobDisplayInformation(job, app) {
display.applicationName =
app.definition.notes.label || display.applicationName;

// https://jira.tacc.utexas.edu/browse/WP-100
// TODOv3: Maybe should filter with includes? some have null/array values
// Note from Sal: We'll probably have to filter with a flag we create
// ourselves with whatever meta object they allow us to
// attach to job input args in the future. For example,
// a webhookUrl will be a required input for interactive jobs,
// but we want to hide that input

// filter non-visible
// display.inputs.filter((input) => {
// const matchingParameter = app.definition.inputs.find((obj) => {
// return input.id === obj.id;
// });
// if (matchingParameter) {
// return matchingParameter.value.visible;
// }
// return true;
// });
// display.parameters.filter((input) => {
// const matchingParameter = app.definition.parameters.find((obj) => {
// return input.id === obj.id;
// });
// if (matchingParameter) {
// return matchingParameter.value.visible;
// }
// return true;
// });

const workPath = envVariables.find(
(env) => env.key === '_tapisJobWorkingDir'
);
Expand All @@ -148,6 +125,7 @@ export function getJobDisplayInformation(job, app) {
// ignore if there is problem using the app definition to improve display
}
}

return display;
}

Expand Down