Closed Bug 1302765 Opened 4 years ago Closed 4 years ago

Allow `./mach taskgraph .. --parameters P` to take a URL

Categories

(Firefox Build System :: Task Configuration, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla53

People

(Reporter: dustin, Assigned: hammad13060, Mentored)

Details

(Keywords: good-first-bug)

Attachments

(1 file, 3 obsolete files)

When experimenting with the task-graph generation, we encourage people to download a `parameters.yml` from a recent decision task and use that.

It would be easier if --parameters could download from a URL (so we can point it to an artifact URL) or even take a taskId and pick the parameters from the most recent run (`--parameters-from-task=<taskId>`).
Assignee: nobody → hammad13060
I have following concerns
- we can obtain parameters in the following ways
    - ./mach taskgraph tasks -p 'https://public-artifacts.taskcluster.net/{taskid}/0/public/parameters.yml'
    - ./mach taskgraph tasks -p '/path/to/file/in/local/directory/parameters.yml'
    - ./mach taskgraph tasks -p '--parameters-from-task=<taskId>' . I can parse the '--parameters' string and obtain the task-id and then fetch parameters by generating url listed in the first case.

- In order to differentiate b/w above cases we can use regular expressions

- function load_parameters_file(options) expects parameters either in a json format or in a yml format.

- This leads to a new problem. Suppose if I am given 'task-id' only, how do I know whether I should fetch a json or a yml ?
Flags: needinfo?(dustin)
The artifact for a decision task is always a YAML filed named `public/parameters.yml`.

Rather than using regular expressions, I'd suggest first trying to `open(..)` the file, and if that fails, try to fetch it.
Flags: needinfo?(dustin)
Comment on attachment 8813546 [details]
Bug 1302765 - Allow `./mach taskgraph .. --parameters P` to take a URL -3;

Instead trying top open a file first and fetching from url only if open() fails, I am trying this approach. what do you think about it ?
Attachment #8813635 - Flags: review?(dustin)
Attachment #8813521 - Flags: review?(dustin)
Attachment #8813522 - Flags: review?(dustin)
Attachment #8813546 - Flags: review?(dustin)
Comment on attachment 8813635 [details]
Bug 1302765 - Allow `./mach taskgraph .. --parameters P` to take a URL -4;

https://reviewboard.mozilla.org/r/95062/#review95300

I like this approach - it is simple and elegant!

From what I understand, the -P option could be

* -P parameters.yml  # just open a local file
* -P https://gist.githubusercontent.com/dustin/.../raw/...  # open a URL
* -P parameters-from-task=KGt8egfvRaqxczIRgOScaw

I'd suggest shortening the latter to `-P taskid=...` instead.

One issue here is that the URL you've constructed is the one that the queue redirects to for S3 artifacts.  If we started using some other service to store artifacts, it would stop working.  Instead, this should construct a URL for getLatestArtifact (https://docs.taskcluster.net/reference/platform/queue/api-docs#getLatestArtifact), which will always redirect to the right place.

This will also need some documentation under taskcluster/docs.  I think both the index.rst and how-to.rst will need attention.
Attachment #8813635 - Flags: review?(dustin) → review-
Base URL : https://queue.taskcluster.net/v1
Route: /task/<taskId>/artifacts/<name>

so route for 'task-id=biR9rzgDT-eAoaLqIY1rWg'
becomes '/task/biR9rzgDT-eAoaLqIY1rWg/artifacts/public/parameters.yml'

right ?

Secondly I need to update the documentation for hacking into the taskgraph. right ?
Flags: needinfo?(dustin)
that's right
Flags: needinfo?(dustin)
Attachment #8813522 - Attachment is obsolete: true
Attachment #8813546 - Attachment is obsolete: true
Attachment #8813635 - Attachment is obsolete: true
Comment on attachment 8813521 [details]
Bug 1302765 - Allow `./mach taskgraph .. --parameters P` to take a URL. URL building mechanism fixed;

https://reviewboard.mozilla.org/r/94972/#review95334

Awesome work!
Attachment #8813521 - Flags: review?(dustin) → review+
Pushed by dmitchell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/55bbce8d1013
Allow `./mach taskgraph .. --parameters P` to take a URL. URL building mechanism fixed; r=dustin
https://hg.mozilla.org/mozilla-central/rev/55bbce8d1013
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Product: TaskCluster → Firefox Build System
You need to log in before you can comment on or make changes to this bug.