zowe-cli icon indicating copy to clipboard operation
zowe-cli copied to clipboard

Job submit --wait-for-output outputting to directory using -d does not output.

Open davleop opened this issue 4 years ago • 5 comments

How to replicate zowe jobs sub ds 'path.to.dataset(ds)' --wfo -d output or locally zowe jobs sub lf path/to/file --wfo -d output

This occurs with and without the directory output present.

Result

jobid:   JOB#####
retcode: CC 0000
jobname: NAME
status:  OUTPUT
Successfully downloaded output to ./output/JOB#####

Then nothing is outputted.

Desired Behavior

  • Output should be similar behavior as if I ran zowe jobs dl o JOB#####

Environment zowe --version: 6.13.0 System: Kernel: 4.4.0-17763-Microsoft x86_64 bits: 64 compiler: gcc v: 5.4.0 Desktop: N/ADistro: Ubuntu 20.04 LTS (Focal Fossa)

davleop avatar May 28 '20 20:05 davleop

@zFernand0 @dkelosky i was willing to help on it, but Is it a bug of code or maybe documentation? looks it is happening cause if the wfo parm is present it is not checking for directory parm...

Submit.Jobs.ts
if (parms.viewAllSpoolContent || parms.waitForOutput) {
...
} else if (parms.directory) {

But when using the parm directory the flag --wfo lose the sense for me as it already wait the job completion to download it?

billpereira avatar Jun 07 '20 02:06 billpereira

hey @billpereira - at a glance I think two things could be done, one for the api and one for the cli.

  • in SubtmitJobs.checkSubmitOptions we could add ImperativeExpect calls to assert that either waitForOutput is specified or directory (not both). See other examples of ImperativeExpect on how this could be done and perhaps add some doc that this options are mutually exclusive.
  • in Submit.definition.ts, perhaps [onlyOneOf](https://github.com/zowe/imperative/blob/master/packages/cmd/src/doc/ICommandDefinition.ts) could be used to say that -d and -wfo are mutually exclusive

Side note (nothing to do just some observations), SubmitJobs.ts is in the /api folder of Zowe CLI. I think the SubmitJobs.checkSubmitOptions method is confusing in retrospect:

  • the method name makes it seem like its doing a check of options (perhaps validating options), but it's actually handling certain option conditions
  • it seems like a CLI-oriented method, accepting options for view output or displaying % complete, perhaps it should be collocated with CLI handlers.

dkelosky avatar Jun 08 '20 13:06 dkelosky

Mutual exclusion is always something that can cause confusion. And in the past we've tried to somewhat avoid it in the CLI. Maybe @MikeBauerCA has some thoughts on that?

As a 3rd option (and maybe the laziest one 😋) is to allow both in the API. i.e. Instead of doing...

if (parms.viewAllSpoolContent || parms.waitForOutput) {
...
} else if (parms.directory) {

we can do

if (parms.viewAllSpoolContent || parms.waitForOutput) {
...
}
if (parms.directory) {

Thoughts?

zFernand0 avatar Jun 08 '20 19:06 zFernand0

Agree @zFernand0 - we've definitely avoided mutually exclusive options. My suggestion was geared towards implementing @davleop's desired behavior given that both options were specified.

BUT, It seems the desired behavior can be achieved with using just --directory output and no --wfo. @zFernand0's proposal would allow both - seems like win-win? 😄

dkelosky avatar Jun 09 '20 12:06 dkelosky

I was also confused with this behaviour and did expect that both will work at once: i though that the (optional) -d will just allow one to redirect output to a custom directory even if --wfo is used

On 9 Jun 2020, at 14:39, Dan Kelosky [email protected] wrote:

Agree @zFernand0 https://github.com/zFernand0 - we've definitely avoided mutually exclusive options. My suggestion was geared towards implementing @davleop https://github.com/davleop's desired behavior given that both options were specified.

BUT, It seems the desired behavior can be achieved with using just --directory output and no --wfo. @zFernand0 https://github.com/zFernand0's proposal would allow both - seems like win-win? 😄

martin-pala-broadcom avatar Jun 09 '20 12:06 martin-pala-broadcom