Page MenuHomePhabricator

toolforge-jobs cli: commands are missing or truncated in list/show output
Closed, InvalidPublicBUG REPORT

Description

List of steps to reproduce:
toolforge-jobs list or toolforge-jobs show <job> (e.g. toolforge-jobs show cfdw)

What happens?:
Commands are missing or truncated in the output.

list
Job name:                  Command:    Job type:               Container:    File log:    Status:
-------------------------  ----------  ----------------------  ------------  -----------  ----------------------------------------
cat-dbl-redir-fixer                    schedule: 6 6 * * 6     tf-python37   no           Last schedule time: 2021-07-10T06:06:00Z
cfdw                                   schedule: 17 * * * *    tf-python37   no           Last schedule time: 2021-07-16T19:17:00Z
cfdwl                                  schedule: 47 * * * *    tf-python37   no           Last schedule time: 2021-07-16T18:47:00Z
commons-potd-importer      jo          schedule: 7 0 * * *     tf-python37   no           Last schedule time: 2021-07-16T00:07:00Z
[...]
show
+------------+------------------------------------------+
| Job name:  | cfdw                                     |
+------------+------------------------------------------+
| Command:   |                                          |
+------------+------------------------------------------+
| Job type:  | schedule: 17 * * * *                     |
+------------+------------------------------------------+
| Container: | tf-python37                              |
+------------+------------------------------------------+
| File log:  | no                                       |
+------------+------------------------------------------+
| Status:    | Last schedule time: 2021-07-16T19:17:00Z |
+------------+------------------------------------------+
| Hints:     | No pods were created for this job.       |
+------------+------------------------------------------+

What should have happened instead?:

The complete command should be displayed.

show
+------------+------------------------------------------+
| Job name:  | cfdw                                     |
+------------+------------------------------------------+
| Command:   | jobs/cfdw                                |
+------------+------------------------------------------+
| Job type:  | schedule: 17 * * * *                     |
+------------+------------------------------------------+
| Container: | tf-python37                              |
+------------+------------------------------------------+
| File log:  | no                                       |
+------------+------------------------------------------+
| Status:    | Last schedule time: 2021-07-16T19:17:00Z |
+------------+------------------------------------------+
| Hints:     | No pods were created for this job.       |
+------------+------------------------------------------+

Event Timeline

I just uploaded new versions of both the API and the CLI.

I cannot reproduce the error with the new versions:

tools.arturo-test-tool@tools-sgebastion-11:~$ toolforge-jobs run cat-dbl-redir-fixer --command jobs/cat-dbl-redir-fixer --image tf-python37 --schedule "6 6 * * 6"
tools.arturo-test-tool@tools-sgebastion-11:~$ toolforge-jobs list
Job name:            Command:                  Job type:            Container:    File log:    Resources:    Status:
-------------------  ------------------------  -------------------  ------------  -----------  ------------  ---------------------------
cat-dbl-redir-fixer  jobs/cat-dbl-redir-fixer  schedule: 6 6 * * 6  tf-python37   yes          default       Last schedule time: unknown
tools.arturo-test-tool@tools-sgebastion-11:~$ toolforge-jobs show cat-dbl-redir-fixer
+------------+------------------------------------+
| Job name:  | cat-dbl-redir-fixer                |
+------------+------------------------------------+
| Command:   | jobs/cat-dbl-redir-fixer           |
+------------+------------------------------------+
| Job type:  | schedule: 6 6 * * 6                |
+------------+------------------------------------+
| Container: | tf-python37                        |
+------------+------------------------------------+
| File log:  | yes                                |
+------------+------------------------------------+
| Resources: | default                            |
+------------+------------------------------------+
| Status:    | Last schedule time: unknown        |
+------------+------------------------------------+
| Hints:     | No pods were created for this job. |
+------------+------------------------------------+

Please try flushing and defining the jobs again.

oh, I actually know what happened here. I changed the way we store the command in the job definition. Now we wrap the command on a /bin/sh exec to support file logging (T286485), and that's preventing the jobs API parser from working properly.

Your job is defined in the old format:

containers:
- command:
  - jobs/cat-dbl-redir-fixer

The toolforge-jobs-framework-api component expects this:

containers:
- command:
  - /bin/sh
  - -c
  - --
  - jobs/cat-dbl-redir-fixer 1>>cat-dbl-redir-fixer.out 2>>cat-dbl-redir-fixer.err

I reloaded all of my jobs. Looks good now.

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

[cloud/toolforge/jobs-framework-api@main] jobs: prevent empty container image if container is no longer available

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

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

[cloud/toolforge/jobs-framework-api@main] jobs: prevent empty cmd spec

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

Change 705842 merged by jenkins-bot:

[cloud/toolforge/jobs-framework-api@main] jobs: prevent empty container image if container is no longer available

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

Change 705843 merged by jenkins-bot:

[cloud/toolforge/jobs-framework-api@main] jobs: prevent empty cmd spec

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