-
Notifications
You must be signed in to change notification settings - Fork 20
Workflows-as-programs: nextstrain run
#407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@tsibley It was really cool to see a working demo of this idea today! A couple of thoughts I had from your lab meeting presentation: Providing
|
Yeah, I saw that in Snk. I'm not sure about auto-generating CLI options based on the workflow's config. It seems to me to be a more complicated way of providing
Yeah, I've waffled on this a bit in my thinking. My old notes are full of
My thinking of overloading
An exception to the verb-nouns command pattern is the So I figured trying to implementing pathogen setup/update into the existing commands would reveal if it was actually feasible or not and give more information to help make the choice. I do think we want a way to list workflows. Haven't quite gotten there yet. I think we can do something other than
+1! |
|
Thanks, @tsibley!
That's fair. My main hope was that we could include the documentation for the config in the interface somehow, thinking that it's nicer for users if they don't have to leave the command line for a website to figure out how the program works. The autogenerated CLI is just an example of one approach, but I'm open to whatever achieves the end goal.
Yeah, I can see how the interface gets complicated fast when you start to bifurcate on workflow vs. runtime. As you test this with people, I'd be most interested in whether external users experience any confusion when trying to update a runtime vs. a workflow. It's obvious to us that these are separate nouns, but if users rely on the verb to signal the noun that's being operated on, it could get confusing. |
|
Thinking out loud about implementation edge cases around fetching workflows:
¹ registering my (probably minority) vote for "something else"; having one verb do two completely different things seems like a bad idea to me… |
|
@genehack— Good questions, I've thought thru these previously (though not articulated them outside of my notes yet) and so have some answers. That said, I welcome others to think thru them too!
I anticipate the constructed source URL would not be exactly that (see below), but in concept, yes.
If it's not a bare word ("no slashes"), I'm inclined to require it be a URL for maximum explicitness/self-explanation to a reader, but I'd consider the "single slash" case of Notably, I don't plan to run Instead, my plan is to have the fully-resolved URL return a ZIP, while leaving it open to support more container formats (e.g. tarballs, Git, etc.) in the future.
My thinking is that That is, Trying to assign both the same name would be an error. In most common usage, of course, the name will be defaulted (i.e. Current on-disk storage plan is something like: The "current"/default version to use will be stored in Names and versions and full URLs of installed pathogens will be reported in You could set up and use specific versions like: This probably means you could handle the
Nod. The way I see it is that it does two completely different things under the hood, but to users who don't know/care about the implementation, it does the same thing: sets up X for use. I don't think users will care if X is a "runtime" or a "pathogen"; it's all just how they get bits of Nextstrain ready for use on their computer. (And at some point, we may blur the lines between "runtime" and "pathogen" if we start bundling the runtimes into the pathogen to support pathogen-specific arbitrary deps. This is the other half of "workflows as programs", though it may not come to pass.) And if we do find it's confusing to users, we can do "something else" later, but if we do "something else" now, it'd be hard to put the horse back in the barn later. (And also, it still may be that I end up finding it too confusing to explain once I spend more time making it a reality.) ⁂ ⁂ ⁂ There's much more to write about that I've noodled on, but this feels like a good stopping point to let some discussion happen. |
I'm very sympathetic to this, but I suspect that while you or I would like to not have to leave the command line to figure out how a program works, we a) are in the minority these days by far, especially among our users and b) already leave the command line for the web browser all the gd time because getting high-quality information (beyond basic reference material) available on the command line is Hard. (Don't tempt me with the good time of arranging to render our rST docs to nroff for use with
Totally. My thinking is that many (most?) users will do the one-time setup of a runtime and a pathogen or two by closely following docs, where understanding the nuance between the nouns is not crucial nor important, and then periodically run |
|
Heavily redacting to just comment on the bits I want to comment on 😁
Yep, I would be in favor of requiring a full URL for exactly that reason.
I hear you about the lack of a decent Git implementation to do the work, but I just tested the zipball download from Github and the thing that gets downloaded does not expand into a Git repo, and there's a tiny voice in the back of my head that says we're gonna end up regretting that. Also means that the The tiny voice is pretty quiet so maybe it's okay to ignore it.
...and by
Sure, I get it — but there's a point where "ease of use" crosses into "obscuring actual functional differences", and for me this is on the wrong side of that line. This is probably the same tiny voice as before though...
++1 |
Sounds ████████, thanks.
👍
Hmm. Can you say more about why you think we'd regret that? I get the inclination, but I've found myself unable to identify a concrete reason we'd want/need these copies to actually be Git repos.
Why not? I don't follow. There's nothing preventing the use of a Git repo at And one usage pattern I didn't mention here yet (though did in convos with Jover) would be potentially supporting that symlink/
o(f)c. :-P
Nod. Hmm. The functional differences being "makes I'm sympathetic to not wanting to use |
As soon as somebody wants to collaborate with us on something, we're gonna want the data in Git. I agree that it might not be a requirement but there are a lot of troubleshooting things that are going to be way harder, I suspect. (I.e., somebody contacts us, they
But if you're manually symlinking/
The difference being runtimes aren't datasets, and I don't see any gain we get out of obscuring that distinction.
Yeah, I don't think I have anything better than everything you've already decided against. 🤷 |
Ah! I think I see our parity mismatch now: you're expecting If someone's at the "hacking on the source" stage of usage, I fully expect them to be managing their own
In my thinking, the user-visible distinction of runtimes vs. pathogens/workflows exists solely as an accidental/incidental implementation detail. Ideally, the whole runtime thing would be subsumed into pathogens/workflows and while it wouldn't be hidden from users, it'd need not be so visible. I guess put in your terms, I see it the other way: what do we gain from highlighting the (current) distinction? (Also, I think we're talking about "Nextstrain pathogens", not "datasets".)
Yes, sorry, I elided some thinking there where I expect that for development (incl. probably CI), we'd be using either a) And like I said, if we didn't want to manually-imitate
How about any reasons why the downsides I described for those aren't actually as downside-y as I think they are?
I'd considered Qualifying it with |
|
Adding another option for command naming: |
Hmm. Intriguing. I think Note that I do want to support not just a single version that you can freely upgrade/downgrade, but multiple concurrent versions. |
|
Re: We already use other technical terms that are not widely understood (e.g. "runtime", "build"), so I don't see the new terminology "pull" as much of a negative. |
|
Yes, agreed we shouldn't use
Ah, I don't think I agree. I think for many people "installing Nextstrain" would naturally include a pathogen of interest to them. We have a nuanced understanding of all the bits and bobs that are "Nextstrain"¹, but experience suggests to me that most users do not. For example, we very often see folks who (understandably) conflate "Nextstrain" with some specific part of it, e.g. Nextclade. IMO, they shouldn't have to care much about it a lot of the time. ¹ and try to communicate some of that in parts of a whole
Those existing terms are often sources of confusion and require explanation. It'd be nice not to add to that if we have other options. |
|
Interesting points. I see what you mean and it makes sense under the "workflows as programs" phrasing, but it's a new perspective for me. I'll let the thoughts marinate... |
👍 🧑🍳 ⁂ To followup on my own statement:
At least, shouldn't use both |
c2cd0f6 to
5873eb4
Compare
5873eb4 to
c8d3b82
Compare
fd602f9 to
16c42f1
Compare
16c42f1 to
b529975
Compare
b529975 to
315895f
Compare
06067b9 to
92dfab9
Compare
joverlee521
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the new commands and they worked well for me. I only left non-blocking comments.
As for future improvements, +1 for including or linking to pathogen specific help docs. I think it'd be even helpful to just include a link to the Nextstrain pathogen GH repo.
| except Exception as e2: | ||
| raise UserError(f""" | ||
| Unable to set up {opts.arg!r}. | ||
| It's not a valid runtime: | ||
| {{e1}} | ||
| heading = partial(colored, "bold") | ||
| failure = partial(colored, "red") | ||
| nor pathogen: | ||
| {{e2}} | ||
| as specified. Double check your spelling and syntax? | ||
| """, e1 = indent(str(e1), " "), e2 = indent(str(e2), " ")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking
During testing of the nextstrain setup command, I hit the GH API rate limit (oops!). In actual use, I would hope it's unlikely that users will hit the rate limit...
I think error message is clear enough, but maybe not for outside users:
$ nextstrain setup --set-default measles@main --force
Error: Unable to set up 'measles@main'.
It's not a valid runtime:
invalid runtime name: 'measles@main'; valid names are: 'docker', 'conda', 'singularity', 'ambient', 'aws-batch'
nor pathogen:
403 Client Error: rate limit exceeded for url: https://api.github.com/repos/nextstrain/measles/commits/main
as specified. Double check your spelling and syntax?
Not sure if it's worth adding some special handling around the GH rate limit error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah, this is even more reason to do this todo sooner than later (it's already near the top-of-queue for me).
cli/nextstrain/cli/pathogens.py
Lines 830 to 835 in b382b59
| # XXX TODO SOON: This logic should probably move into nextstrain.org endpoints | |
| # (and start us down the road of a real Nextstrain pathogen registry). That | |
| # would also give us insight into usage and allows us the flexibility to move | |
| # away from Git-based distribution in the future. | |
| # -trs, 3 Feb 2025 | |
| def github_repo_latest_ref(repo_name: str) -> Optional[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we move to nextstrain.org endpoints, would it just authenticate the requests as nextstrain-bot and have a higher GH API rate limit? Would we then have to worry about the secondary rate limits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it would increase the requests that we're making as nextstrain-bot from the nextstrain.org IPs. Would that be enough to hit secondary rate limits? I don't think so? We could model it out to give ourselves a sense of headroom if we want, or we could wait and see. One thing that the nextstrain.org requests to GitHub have going for them is good HTTP caching, so lots of requests shouldn't/won't actually hit GitHub. (And we could add application-layer caching above the HTTP cache for things like pathogen lookups if we had to.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that many (most?) CLI installations already go thru nextstrain.org and cause it to make requests to GitHub. We haven't had an issue there, even with lots of our CI using that installation method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, I totally forgot that the CLI installation already goes through nextstrain.org -> GitHub. Happy to wait and see!
While most image usage via Docker (or Singularity) allows for overriding the default initial workdir (e.g. /nextstrain/build), usage via AWS Batch does not. Support it via our own environment variable instead. Generally useful, but useful in particular because it gives Nextstrain CLI a bit more flexibility in how it implements existing features like pathogen root vs. workflow directories¹ and upcoming features like analysis directories separate from pathogen source.² ¹ <nextstrain/cli@fc2afdf> ² <nextstrain/cli#407>
While most image usage via Docker (or Singularity) allows for overriding the default initial workdir (e.g. /nextstrain/build), usage via AWS Batch does not. Support it via our own environment variable instead. Generally useful, but useful in particular because it gives Nextstrain CLI a bit more flexibility in how it implements existing features like pathogen root vs. workflow directories¹ and upcoming features like analysis directories separate from pathogen source.² ¹ <nextstrain/cli@fc2afdf> ² <nextstrain/cli#407>
#421 follows up on this line of discussion. |
Declare compatibility with `nextstrain run`. Related-to: <nextstrain/public#1> Related-to: <nextstrain/cli#407>
b56d20d to
ef44bc3
Compare
I reviewed the I think it ends up being too… something. It feels like it gets back into the "familiar with Git" territory we're avoiding. In some places, it feels like it suggests you can use I'm still open to terminology changes in the future, but I don't want to block this functionality on that. I think the terms are good enough for now, and we can see how they land among other users and actual usage. |
…version_lax() The lax implementation is always successful at producing a Version object suitable for comparisons, even if the version isn't a valid Python package version. This makes it useful for non-Python ecosystems, such as Conda packages, and is what I want to use for pathogen versions too. Renames the strict parse_version() previously present in util to parse_version_strict() because it raises an exception on invalid versions. It is still only used internally in util to parse versions that we expect to be valid.
…ormation Preserves 1) the original version string and 2) whether parse_version_lax() found it PEP-440-compliant or not. The original version string is useful even for compliant versions, as stringifying a Version object will return a normalized representation that may not string compare identically.
They're going to be used for not just runners but also pathogens, so remove "runner" from their names.
…ners themselves Anticipates introduction of pathogens as a thing that can be setup too, which will handle their own default setting.
ef44bc3 to
5c4c136
Compare
…ured yet Suggested by @joverlee521 during review.¹ I'd briefly considered this during development, but opted not to do so. I think I didn't want to change the setup behaviour for runtimes? But I've reconsidered that, especially given that we've been moving away from reliance on the Docker runtime as a fallback/implicit default. See our installation instructions' blanket use of --set-default² and our thoughts on making Docker less assumed.³ ¹ <#407 (comment)> ² <https://docs.nextstrain.org/en/latest/install.html#set-up-a-nextstrain-runtime> ³ <#164>
…ured yet Suggested by @joverlee521 during review.¹ I'd briefly considered this during development, but opted not to do so. I think I didn't want to change the setup behaviour for runtimes? But I've reconsidered that, especially given that we've been moving away from reliance on the Docker runtime as a fallback/implicit default. See our installation instructions' blanket use of --set-default² and our thoughts on making Docker less assumed.³ ¹ <#407 (comment)> ² <https://docs.nextstrain.org/en/latest/install.html#set-up-a-nextstrain-runtime> ³ <#164>
61553f3 to
d62f255
Compare
|
Repushed to add CHANGES entries. |
…ured yet Suggested by @joverlee521 during review.¹ I'd briefly considered this during development, but opted not to do so. I think I didn't want to change the setup behaviour for runtimes? But I've reconsidered that, especially given that we've been moving away from reliance on the Docker runtime as a fallback/implicit default. See our installation instructions' blanket use of --set-default² and our thoughts on making Docker less assumed.³ ¹ <#407 (comment)> ² <https://docs.nextstrain.org/en/latest/install.html#set-up-a-nextstrain-runtime> ³ <#164>
e2ed56a to
924f20c
Compare
Adds a new command, `nextstrain run`, to run (compatible) pathogen workflows in a more managed way with easier update paths, without the need for user-facing Git, with support for multiple versions, and with support for concurrent-but-separate analyses via the same workflow. Supported by changes to - `nextstrain setup` to obtain and set up specific versions of pathogens - `nextstrain update` to keep pathogens up-to-date - `nextstrain version` to report on pathogen versions available locally At the moment, the only compatible pathogen is measles at my not-yet-finished demo/prototype branch.¹ Avian flu should not be far behind, though. There's a lot of functionality (and polish) here and elsewhere still todo to fully realize the sweeping goals of workflows-as-programs², but this is a fully-usable first piece of the puzzle that can stand on its own for now. ¹ <nextstrain/measles#55> ² <nextstrain/public#1>
924f20c to
37305d1
Compare
|
The long discussion of defaults has a resolution: the originally-implemented behaviour in this PR will be used. I'll be merging this once checks pass. (There's lots more work to do in this workflows-as-programs endeavor, of course, but that will be left for subsequent PRs here and elsewhere.) |
based on #419
Adds a new command,
nextstrain run, to run (compatible) pathogen workflows workflows in a more managed way with easier update paths, without the need for user-facing Git, with support for multiple versions, and with support for concurrent-but-separate analyses via the same workflow.Supported by changes to
nextstrain setupto obtain and set up specific versions of pathogensnextstrain updateto keep pathogens up-to-datenextstrain versionto report on pathogen versions set upTry out setting up a pathogen and running it yourself. First, install
nextstrainbuilt from this PR:Linux/macOS:
Windows:
At the moment, the only compatible pathogen is measles at my not-yet-finished demo/prototype branch. Avian flu should not be far behind, though.
Some commands to try:
Note that on any of the updated command documentation pages linked above you can press
dto see a colorized diff against the latest non-PR version.There's a lot of functionality (and polish) here and elsewhere still todo to fully realize the sweeping goals of workflows-as-programs, but this is a fully-usable first piece of the puzzle that can stand on its own for now.
Checklist
first setup" behaviour instead? For runtimes too, not just pathogens.
Workflows-as-programs:
nextstrain run#407 (comment)Workflows-as-programs:
nextstrain run#407 (comment)--helpand docs: "pathogen" → "pathogen repository"?--helpand docs: "pathogen" vs. "workflow" / "pathogen workflow"Workflows-as-programs:
nextstrain run#407 (comment)