-
Notifications
You must be signed in to change notification settings - Fork 0
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
TASK: Robust Metamist Integrations #784
Open
milo-hyben
wants to merge
13
commits into
main
Choose a base branch
from
metamist-integration-enhancements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
47be490
First metamist set of unit tests.
milo-hyben 64fc4af
First metamist set of unit tests.
milo-hyben 69d4d7e
More unit tests for metamist.
milo-hyben 3bc0343
Call Metamist object instead of calling API directly.
milo-hyben 07f5b07
Removed unused import.
milo-hyben 73d8041
Add dependency on tenacity, used in retry API calls.
milo-hyben 5eff312
Wrapped APi calls with retry if ServiceException is thrown by metamis…
milo-hyben 9b91229
Fix for index file extension check.
milo-hyben 5140444
Add missing dependency.
milo-hyben 145312e
Add missing dependency.
milo-hyben b209a54
Logging Metamist API calls payload on failures.
milo-hyben da300a1
Merge main.
milo-hyben 644d8f4
Removing unused imports.
milo-hyben File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,12 +35,10 @@ def complete_analysis_job( | |
update_analysis_meta (Callable | None): function to update analysis meta | ||
tolerate_missing (bool): if True, allow missing output | ||
""" | ||
import traceback | ||
|
||
from cpg_utils import to_path | ||
from metamist.apis import AnalysisApi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! Gross that we used to do this here. |
||
from metamist.exceptions import ApiException | ||
from metamist.models import Analysis, AnalysisStatus | ||
|
||
from .metamist import AnalysisStatus, get_metamist | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We just need to keep an eye on this it case it creates any pickling issues. Let's try a test run later! |
||
|
||
assert isinstance(output, str) | ||
output_cloudpath = to_path(output) | ||
|
@@ -76,22 +74,20 @@ def complete_analysis_job( | |
if not output_cloudpath.is_dir(): | ||
meta |= {'size': output_cloudpath.stat().st_size} | ||
|
||
this_analysis = Analysis( | ||
type=analysis_type, | ||
status=AnalysisStatus('completed'), | ||
a_id = get_metamist().create_analysis( | ||
output=output, | ||
type_=analysis_type, | ||
status=AnalysisStatus('completed'), | ||
sequencing_group_ids=sg_ids, | ||
dataset=project_name, | ||
meta=meta, | ||
) | ||
aapi = AnalysisApi() | ||
try: | ||
a_id = aapi.create_analysis(project=project_name, analysis=this_analysis) | ||
except ApiException: | ||
traceback.print_exc() | ||
if a_id is None: | ||
print(f'Creation of Analysis failed (type={analysis_type}, output={output}) in {project_name}') | ||
# What Exception should we raise here? | ||
raise | ||
else: | ||
print(f'Created Analysis(id={a_id}, type={analysis_type}, output={output}) in {project_name}') | ||
return | ||
|
||
|
||
class StatusReporterError(Exception): | ||
|
@@ -158,7 +154,10 @@ def create_analysis( | |
|
||
# find all relevant SG IDs | ||
sg_ids = target.get_sequencing_group_ids() | ||
py_job = b.new_python_job(f'Register analysis output {output}', job_attr or {} | {'tool': 'metamist'}) | ||
py_job = b.new_python_job( | ||
f'Register analysis output {output}', | ||
job_attr or {} | {'tool': 'metamist'}, | ||
) | ||
py_job.image(get_config()['workflow']['driver_image']) | ||
py_job.call( | ||
complete_analysis_job, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ black | |
pytest | ||
pytest_mock | ||
mypy | ||
tenacity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
'bokeh', | ||
'numpy', | ||
'click', | ||
'tenacity', | ||
], | ||
extras_require={ | ||
'test': [ | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is there a way for us to be alerted if too many of these exceptions are raised?