xenon-middleware / xenon-cli

Perform files and jobs operations with Xenon library from command line
http://nlesc.github.io/Xenon/
Apache License 2.0
2 stars 3 forks source link

Query accounting info for failed jobs #70

Open arnikz opened 4 years ago

arnikz commented 4 years ago

This is a feature request: add option to list jobs with non-zero exit code. Currently, I use an ad hoc solution to post-process the output line(s).

sverhoeven commented 4 years ago

The Xenon api does not have a method to ask for only non-zero exit code jobs. Only the statuses of a list of job identifiers can be requested.

You could use the JSON formatted output for filtering with jq, for example to get a list of failed job ids:

xenon --json scheduler slurm --location ssh://localhost:10022 \
  --user xenon --password javagat list --identifier 2 \
  | jq '.statuses | map(select(.done and .exitCode != 0)) | map(.jobIdentifier)'

I could add the following option to the list sub command:

--exclude-exitcode=0      Only list completed job statuses which do not have the given exit code.