Skip to content

Commit

Permalink
task/WP-100: Display all jobAttributes via getJobDisplayInformation (#…
Browse files Browse the repository at this point in the history
…868)

* filtered out hidden inputs

* added more jobAttributes

* added a new function filterHiddenObjects to combine filters

* added test suites for filter input and parameters

---------

Co-authored-by: Chandra Y <[email protected]>
  • Loading branch information
asimregmi and chandra-tacc authored Oct 24, 2023
1 parent fa8c979 commit 31af29e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 47 deletions.
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
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

0 comments on commit 31af29e

Please sign in to comment.