New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 801346 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 758630



Sign in to add a comment

--swarming-py-path argument to trigger scripts is problematic and should be removed

Project Member Reported by kbr@chromium.org, Jan 11 2018

Issue description

In  Issue 758630  the ability to inject a Swarming trigger script was added, in order to customize how jobs are triggered in the Swarming pool.

The mechanism is very useful, but the --swarming-py-path argument that is passed to the trigger script is highly problematic. Here's why:

1) The trigger script absolutely has to filter out this argument before turning around and invoking "swarming.py trigger". Otherwise, the target script or executable will see it and be confused by it.

2) The easiest way to do this is to use argparse to add an argument "--swarming-py-path", and use ArgumentParser.parse_known_args() to chomp this and other expected arguments before calling "swarming.py trigger".

3) Unfortunately, ArgumentParser has built-in functionality to allow arguments to be abbreviated. --swarming-py-path therefore collides with the necessary argument "--swarming" which is passed to swarming.py. This ends up chomping the wrong command line argument.

4) Adding another argument to argparse "--swarming" does not really help, because it turns out that "--swarming-py-path" is placed after the "--" in the command line, and this causes argparse to not consume it, anyway.

The best solution is for recipe_modules/swarming/api.py  to not pass this argument to the trigger script at all. It's unnecessary, because the trigger script is invoked out of the Chromium checkout, and the script can figure out where src/tools/swarming_client lives relative to it and just invoke it itself.

 
Ah, I didn't realize that the argument abbreviation was even a thing, and that definitely could cause some issues. I think it's fine to remove this.

Comment 2 by kbr@chromium.org, Jan 12 2018

Labels: -Pri-1 Pri-2
Downgrading to P2. There are other more important issues and I've already worked around this one.

Comment 3 by eyaich@chromium.org, Jan 16 2018

Owner: eyaich@chromium.org
Thanks for calling this out Ken.  I was planning on dropping it in the src side script, but I also wasn't aware of the abbreviation issue.  

I can own this since it is necessary to get the trigger script working.
I landed a CL in #4 which should have fixed this. I was working on that last week, but didn't assign this bug to myself, sorry.

Comment 6 by kbr@chromium.org, Jan 17 2018

Owner: martiniss@chromium.org
Status: Fixed (was: Assigned)
Thanks Stephen. Sorry Emily for the wasted work, but at least this is fixed now.

Sign in to add a comment