Closed chrisfandrade16 closed 1 month ago
@chrisfandrade16 LGMT, I think this would fix https://github.com/CHIMEFRB/workflow/issues/97, have you tested the case were the Work object is retried and keeps the same parameters?
@odarotto Good idea, I have not tried that...any ideas on how to test that? A function that fails the first time but works the second? Perhaps I can think of something.
@odarotto Just tested it. Ran a function that fails the first time (checks for a file, if does not exist, fails but creates it so the next time it succeeds), with work.retries = 2. Tried it with both @click.argument and @click.option and is_flag=True, all the parameters were still there the second time. Honestly, I'm not sure what I did to fix that issue though haha. I don't know what configure.defaults
was doing in the first place to cause that.
Since we are using the
.main
method to call a Click command (as opposed to.callback
which skips the Click CLI), all defaults are already calculated. As such, we don't even need to useconfigure.defaults
. Instead, I modifiedconfigure.arguments
to correctly build the Click CLI command for the.main
method usage, such that the Click CLI is used and all defaults, type conversions, and constraints and performed automatically by Click. This new modifiedconfigure.arguments
function accounts for both@click.argument
and@click.option
types, as well asis_flag=True
types.