-
Notifications
You must be signed in to change notification settings - Fork 1
Added workflows to register CLEM preprocessing results #396
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
Merged
Merged
Changes from 40 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
7b50bb6
Used Optional[] as type hint for Python 3.9 compatibility
tieneupin e796663
Raise Exception if no TransportManager instance is found when running…
tieneupin 0167f96
Corrected database call in 'validate_and_sanitise' function; simplifi…
tieneupin 6dac704
Added functions to post requests to the server to register LIF and TI…
tieneupin bbd3e29
Used Path object to resolve file path in 'validate_and_sanitise'; add…
tieneupin b6a4297
Corrected returned booleans at the end of different workflow branches
tieneupin 9d03fa2
Corrected inconsistent returns and raises in functions
tieneupin dadb02d
Simplified CLEM BaseModels and updated CLEMContext file handling logi…
tieneupin c69a22f
Allow forward slashes in series name when validating input
tieneupin 276ee54
Added folder to store module feedback callback workflows in
tieneupin f6fd56d
Added feedback callback elif-blocks for CLEM workflows
tieneupin 5ef7218
Updated 'lif_to_stack' API endpoint to load and pass on more information
tieneupin d29b8ed
Updated 'lif_to_stack' workflow to handle additional zocalo wrapper p…
tieneupin 398b09e
Notes on how 'feedback_callback' works
tieneupin 7820501
Constructed parameters from file path; updated parameter names
tieneupin 51c528c
Fixed comments
tieneupin 2d6d367
Removed 'instrument_name' parameter from murfey.server.murfey_db
tieneupin e8447e0
Refactored CLEM Murfey workflows
tieneupin c4bdfc7
Missed deleting the old file
tieneupin a01a786
Updated TIFF Pydantic model
tieneupin 185158f
Added Pydantic models to validate LIF and TIFF preprocessing result m…
tieneupin ad9a489
Changed 'color' to the more generic 'channel'
tieneupin c9ffa31
Refactored functions to parse CLEM preprocessing results and started …
tieneupin c3c78a0
Completed draft of function to register LIF preprocessing results
tieneupin f9858ee
Added 'number_of_members' as a parameter to register for a series
tieneupin ecf6d38
Added 'return None' to CLEM results registration code blocks
tieneupin a132b86
Merged recent changes from 'main' branch
tieneupin f7681c9
Rewrote 'tiff_to_stack' function to work with Zocalo wrapper
tieneupin 480a7e4
Modified URLs for CLEM preprocesisng API endpoints
tieneupin 09e85cc
Stringified TIFF list when submitting to cluster
tieneupin 3cd3344
Ensured file paths in recipes are represented canonically
tieneupin 816d434
Adjusted order of parameters
tieneupin 8576eb1
Canonicalisation of strings appears to not be needed when submitting …
tieneupin 4e5b202
Fixed outdated parameters to pass over to 'tiff_to_stack' workflow
tieneupin fbc9fe5
Fixed broken database refreshes and updated logged messages
tieneupin 8bcd8c0
Updated 'TIFFPreprocessingResult' Pydantic model to parse stringified…
tieneupin 2cc5624
Completed function to register TIFF preprocessing results
tieneupin 0811cba
Missed a return statement in 'except' block
tieneupin 3fd77b4
Rewrote CLEM preprocessing results registration workflows to make use…
tieneupin 93c08ea
Adjusted naming convention for LIF and TIFF processing functions and …
tieneupin 9cd58ff
Replaced 'row' with 'session_row' to make variable more explicit
tieneupin befd420
Rewrote function to iterate over entry point names and run the match
tieneupin 5397c0e
Missed a print statement
tieneupin fa6c5c8
Reverted entry point group name to 'murfey.workflows' to facilitate g…
tieneupin 1a0057b
Optimised code logic for LIF and TIFF processing API endpoints
tieneupin feade10
Added 'requeue=False' argument when nacking message
tieneupin 36efb6f
Fixed logic when reading rsync base path from machine config
tieneupin aafc518
Used 'entry_points' from 'backports.entry_points_selectable' instead
tieneupin cb1a570
Used 'entry_points' instance from 'backports.entry_points_selectable'…
tieneupin 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Empty file.
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| """ | ||
| Script to allow Murfey to submit the LIF-to-STACK job to the cluster. | ||
| The recipe referred to here is stored on GitLab. | ||
| """ | ||
|
|
||
| from pathlib import Path | ||
| from typing import Optional | ||
|
|
||
| from murfey.util.config import get_machine_config | ||
|
|
||
| try: | ||
| from murfey.server.ispyb import TransportManager # Session | ||
| except AttributeError: | ||
| pass # Ignore if ISPyB credentials environment variable not set | ||
|
|
||
|
|
||
| def zocalo_cluster_request( | ||
| file: Path, | ||
| root_folder: str, | ||
| session_id: int, # Provided by the client via the API endpoint | ||
| instrument_name: str, # Acquired by looking up the Session table | ||
| messenger: Optional[TransportManager] = None, | ||
| ): | ||
| if messenger: | ||
| # Use file path parts to construct parameters | ||
| path_parts = list((file.parent / file.stem).parts) | ||
| # Replace leading "/" in Unix paths | ||
| path_parts[0] = "" if path_parts[0] == "/" else path_parts[0] | ||
| try: | ||
| # Find the position of the root folder in the list | ||
| root_index = [p.lower() for p in path_parts].index(root_folder.lower()) | ||
| except ValueError: | ||
| raise Exception( | ||
| f"Unable to find the root folder {root_folder!r} in the file path {file!r}" | ||
| ) | ||
|
|
||
| # Construct the session and job name | ||
| session_dir = "/".join(path_parts[:root_index]) | ||
| job_name = "--".join( | ||
| [p.replace(" ", "_") if " " in p else p for p in path_parts][ | ||
| root_index + 1 : | ||
| ] | ||
| ) | ||
|
|
||
| # Load machine config to get the feedback queue | ||
| machine_config = get_machine_config() | ||
| feedback_queue = machine_config[instrument_name].feedback_queue | ||
|
|
||
| # Send the message | ||
| # The keys under "parameters" will populate all the matching fields in {} | ||
| # in the processing recipe | ||
| messenger.send( | ||
| "processing_recipe", | ||
| { | ||
| "recipes": ["clem-lif-to-stack"], | ||
| "parameters": { | ||
| # Job parameters | ||
| "lif_file": f"{str(file)}", | ||
| "root_folder": root_folder, | ||
| # Other recipe parameters | ||
| "session_dir": f"{str(session_dir)}", | ||
| "session_id": session_id, | ||
| "job_name": job_name, | ||
| "feedback_queue": feedback_queue, | ||
| }, | ||
| }, | ||
| new_connection=True, | ||
| ) | ||
| else: | ||
| raise Exception("Unable to find transport manager") | ||
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.
Uh oh!
There was an error while loading. Please reload this page.