Skip to content
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

Allow rerunning of workflow invocations #13534

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

simonbray
Copy link
Member

Implements #11340.

So far I just have a basic API test; should I try to write a selenium test as well?

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

Comment on lines 474 to 507
@expose_api_raw_anonymous_and_sessionless
def invocation_build_for_rerun(self, trans: GalaxyWebTransaction, invocation_id, **kwd):
"""
GET /api/invocations/{encoded_invocation_id}/build_for_rerun

Returns a workflow file formatted according to the 'run' export style, prepopulated with
inputs and parameters from a previous invocation. Note the result is heavily tied to the UI
(e.g. which history is currently being used).

:type history_id: encoded history ID. If not supplied, defaults to current history.
:param history_id: str
"""

decoded_workflow_invocation_id = self.decode_id(invocation_id)
workflow_invocation = self.workflow_manager.get_invocation(trans, decoded_workflow_invocation_id, eager=True)
if not workflow_invocation:
return None

workflow = workflow_invocation.workflow

history_id = kwd.get("history_id")
history = None
if history_id:
history = self.history_manager.get_accessible(
self.decode_id(history_id), trans.user, current_history=trans.history
)
ret_dict = self.workflow_contents_manager._workflow_to_dict_run(
trans,
workflow.stored_workflow,
workflow,
history=history or trans.history,
invocation=workflow_invocation,
)
return format_return_as_json(ret_dict, pretty=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we shouldn't add an API endpoint here, this can and should use the existing API.

Copy link
Member

@mvdbeek mvdbeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be possible without backend changes. We can fetch all parameters via the invocations API.

@simonbray
Copy link
Member Author

This should be possible without backend changes. We can fetch all parameters via the invocations API.

Hm, ok. The front-end expects the form parameters to be submitted in a certain way, I assume you are not suggesting changing that. So the process of patching the workflow run dictionary with the invocation parameters should be done in client/src/components/Workflow/Run/services.js?

@mvdbeek
Copy link
Member

mvdbeek commented Mar 14, 2022

The contents of services.js should only be responsible for fetching things from the API. How I would do this is to add an additional invocationId prop to WorkflowRun (that part looks good ✅ in the PR), fetch the invocation parameters in the component and merge in the invocation parameter somewhere in WorkflowRunModel.

@dannon
Copy link
Member

dannon commented Mar 14, 2022

Nice! +1 to Marius's suggestions, but this is going to be nice!

@simonbray simonbray force-pushed the rerun-inv branch 4 times, most recently from ac8e746 to 59ce23f Compare July 20, 2022 09:07
@mvdbeek mvdbeek marked this pull request as draft October 17, 2022 09:03
@mvdbeek mvdbeek changed the title [WIP] Allow rerunning of workflow invocations Allow rerunning of workflow invocations Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants