Page MenuHomePhabricator

toolforge-jobs: merge stdout/stderr output
Closed, ResolvedPublicFeature

Description

Feature summary
Add a configuration parameter similar to jsub -j y (docs on wikitech): "send standard output and error together to the output file".

Use case(s)
The bot framework I use redirects most logging to stderr, whereas some relevant parts in my code also send info to stdout. Having logs split in two files is detrimental for properly understanding program flow and debugging.

Benefits
Reduced logdir bloat (only one file per task instead of two), better tracking of log output, closer resemblance to SGE.

Related Objects

Event Timeline

Agreed this would be a good feature (along with T304421). As a workaround, I tweaked my script by appending 2>&1 to get this behavior.

Since T302211, T304421 and T301901 all address different challenges on how to treat stdout and stderr, it makes sense that we agree on an acceptable approach attempting to solve these:

  1. One notable grey area is how T302211 is going to interact with the others. For example should users be allowed to provide both --merge-logs and either --out or -err (from T304421) or both at the same time, and if so, how will the logic be treated?
  2. If users are allowed to supply --merge-logs together with --out and --err, what happens when --out and --err doesn't point to the same directory? should we always use --out file to store the merged logs regardless of whether --err is provided or not?

Implementing --stdout and --stderr puts us in-route to solve this because then we can just make some minor code changes to allow for specifying the same file for both --stdout and --stderr

Change 827592 had a related patch set uploaded (by Raymond Ndibe; author: Raymond Ndibe):

[cloud/toolforge/jobs-framework-cli@master] jobs-framework-cli: add --stdout and --stderr args to cli

https://gerrit.wikimedia.org/r/827592

Change 827594 had a related patch set uploaded (by Raymond Ndibe; author: Raymond Ndibe):

[cloud/toolforge/jobs-framework-api@main] jobs-framework-api: add --stdout and --stderr args to cli

https://gerrit.wikimedia.org/r/827594

My proposal is that we leave the current filelog option as is. I think the investment that will really benefit us is trying to work on the root problem: T127367: Provide modern, non-NFS error log solution for Toolforge webservices and bots

Change 867591 had a related patch set uploaded (by Arturo Borrero Gonzalez; author: Arturo Borrero Gonzalez):

[cloud/toolforge/jobs-framework-api@main] tjf: separate command management into its own file

https://gerrit.wikimedia.org/r/867591

Change 868076 had a related patch set uploaded (by Arturo Borrero Gonzalez; author: Arturo Borrero Gonzalez):

[cloud/toolforge/jobs-framework-api@main] command: move log redirections to the wrapper sh call

https://gerrit.wikimedia.org/r/868076

Change 867591 merged by jenkins-bot:

[cloud/toolforge/jobs-framework-api@main] tjf: separate command management into its own file

https://gerrit.wikimedia.org/r/867591

Change 868076 merged by jenkins-bot:

[cloud/toolforge/jobs-framework-api@main] command: move log redirections to the wrapper sh call

https://gerrit.wikimedia.org/r/868076

Change 871171 had a related patch set uploaded (by Arturo Borrero Gonzalez; author: Arturo Borrero Gonzalez):

[cloud/toolforge/jobs-framework-api@main] command: introduce filelog_std{out,err} parameters

https://gerrit.wikimedia.org/r/871171

Change 871171 merged by jenkins-bot:

[cloud/toolforge/jobs-framework-api@main] command: introduce filelog_std{out,err} parameters

https://gerrit.wikimedia.org/r/871171

Change 827594 merged by jenkins-bot:

[cloud/toolforge/jobs-framework-api@main] jobs-framework-api: add filelog_stdout and filelog_stderr arguments

https://gerrit.wikimedia.org/r/827594

Change 827592 merged by jenkins-bot:

[cloud/toolforge/jobs-framework-cli@master] jobs-framework-cli: add --filelog-stdout and --filelog-stderr args to cli

https://gerrit.wikimedia.org/r/827592

Change 881409 had a related patch set uploaded (by Arturo Borrero Gonzalez; author: Arturo Borrero Gonzalez):

[cloud/toolforge/jobs-framework-cli@master] loaded: make it understand filelog, filelog_stdout, filelog_stderr

https://gerrit.wikimedia.org/r/881409

Change 881409 merged by Arturo Borrero Gonzalez:

[cloud/toolforge/jobs-framework-cli@master] loader: make it understand filelog, filelog_stdout, filelog_stderr

https://gerrit.wikimedia.org/r/881409