-
Notifications
You must be signed in to change notification settings - Fork 27
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
set default log file by job outcome #2025
base: master
Are you sure you want to change the base?
set default log file by job outcome #2025
Conversation
dfe8147
to
8f97803
Compare
src/views/Log.vue
Outdated
}, | ||
workflowStatus () { | ||
if (this.workflows[0].node.stateTotals.failed) { | ||
return 'failed' | ||
} | ||
if (this.workflows[0].node.stateTotals.submitted | this.workflows[0].node.stateTotals.running | this.workflows[0].node.stateTotals.succeeded) { | ||
return 'succeeded' | ||
} | ||
if (this.workflows[0].node.stateTotals['submit-failed']) { | ||
return 'submit-failed' | ||
} | ||
return 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow's stateTotals
tells us how many tasks are in each state (e.g. if there are any failed tasks in the workflow), not the state of the particular job that we are requesting the log file for.
To get the job status, I think you want something along these lines:
if (this.jobLog) {
// we are looking at a job log => pick the appropriate log file based on its state
// get the job from the store
this.$workflowService.$index[this.id]
return ...
} else {
// we are viewing the workflow log => always default to the latest log file
return ...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When navigating to the log view directly, e.g. #/log/one
, there is no data on the workflow in the store, so I think the log view would have to issue a graphql query for the particular job status?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also another thing is what if the workflow is stopped? I guess we could add a query in the UIServer schema for getting the job state from the DB (like what the analysis view does)? Or is this more effort than it's worth?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dammit, good point, we could use an offline query, but I'm not sure if we can retrieve the status field without making changes to the backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markgrahamdawson From discussing today, we'll settle on a live query, like this:
query JobState($id: ID!) {
job (id: $id) {
state
}
}
(As I mentioned, we can skip the query if the file
in intialOptions
is pre-populated as in master...MetRonnie:cylc-ui:menu-log-file)
if (result.data.jobs[0].state === 'failed') { | ||
return 'job.err' | ||
} | ||
if (result.data.jobs[0].state === 'submit-failed') { | ||
return 'job-activity.log' | ||
} | ||
return 'job.out' // rather than undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use import { JobStateLogFileMap } from '@/model/JobState.model'
if (result.data.jobs[0].state === 'failed') { | |
return 'job.err' | |
} | |
if (result.data.jobs[0].state === 'submit-failed') { | |
return 'job-activity.log' | |
} | |
return 'job.out' // rather than undefined | |
return JobStateLogFileMap.get(result.data.jobs[0].state) || 'job.out' |
This pr now implements setting default log file by job outcome in two ways:
If the user navigates to the log view through the node menu the job state is passed to the view as in this pr...
master...MetRonnie:cylc-ui:menu-log-file
If the user manually types in the path of the job via the input in the log view a new query is made as in this pr...
offline data: enable querying failed jobs cylc-uiserver#657
Closes #1241
Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).?.?.x
branch.