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

Don't re-import TRS workflow if it already exists #16412

Closed
wants to merge 1 commit into from

Conversation

mvdbeek
Copy link
Member

@mvdbeek mvdbeek commented Jul 16, 2023

Works for postgres and sqlite. I think this might be the first time we query on JSON attributes ... let's try to never do that again.

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

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

w.source_metadata = {"trs_server": "dockstore", "trs_tool_id": TRS_TOOL_ID, "trs_version_id": TRS_TOOL_VERSION}
app.model.session.add(w)
app.model.session.commit()
app.model.session.flush()
Copy link
Member

Choose a reason for hiding this comment

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

no need to flush after a commit, right?

w.stored_workflow.user = u
w.source_metadata = {"trs_server": "dockstore", "trs_tool_id": TRS_TOOL_ID, "trs_version_id": TRS_TOOL_VERSION}
app.model.session.add(w)
app.model.session.commit()
Copy link
Member

Choose a reason for hiding this comment

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

actually, no need to commit either: it's within a session.begin context manager, so it will commit on exit.

return column

return sa_session.execute(
select([model.Workflow])
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
select([model.Workflow])
select(model.Workflow)

not an error, but deprecated

@@ -320,6 +323,31 @@ def attach_stored_workflow(self, trans, workflow):
trans.sa_session.commit()
return stored_workflow

def get_workflow_by_trs_id_and_version(self, sa_session, trs_id: str, trs_version: str, user_id: int) -> Optional[model.Workflow]:
def to_json(column, keys: List[str]):
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason for passing a list? I see only 2 calls, both pass a list of 1, and then you iterate over the items in the list (and using only the last item anyway). Why not just pass the one key?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to generalize the function eventually, but this can actually already be a string or a list, so this isn't necessary in any case.

@mvdbeek mvdbeek modified the milestones: 23.2, 24.0 Dec 19, 2023
@jdavcs jdavcs modified the milestones: 24.0, 24.1 Mar 1, 2024
@mvdbeek mvdbeek removed this from the 24.1 milestone May 14, 2024
@mvdbeek
Copy link
Member Author

mvdbeek commented Nov 28, 2024

Done in #18979

@mvdbeek mvdbeek closed this Nov 28, 2024
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.

2 participants