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

Create the mock metadatamanager / workflow run manager #305

Closed
wants to merge 36 commits into from

Conversation

alexiswl
Copy link
Member

Stacky McStackFace

This will probably become a key piece of infrastrucuture...
If you don't like it's name... I hope that inspires you to build its replacement

This CDK stack will imitate the events of the workflow run manager.

There are three main parts of this stack:

Part 1 - Glue the BCLConvertManager to the BSSHFastqCopyManager 🚧

This Construct is known as Scotch. A stock-standard glue.

This will be all one construct

Construct 1a ✅

Input Event Source: orcabus.bclconvertmanager
Input Event DetailType: orcabus.workflowrunstatechange
Input Event status: succeeded

Output Event source: orcabus.workflowrunmanager
Output Event DetailType: orcabus.workflowrunstatechange
Output Event status: complete

  • The BCLConvertManagerEventHandler Construct
    • This will be triggered by the completion event from the BCLConvertManager stack.
    • Contains a standard workflow run statechange, and includes the samplesheet gz and the instrument run id
    • Pushes a workflow run manager event saying that the BCLConvert Manager has complete.

Construct 1b 🚧

Input Event Source: orcabus.workflowrunmanager
Input Event DetailType: orcabus.workflowrunstatechange
Input Event status: complete

Output Event source: orcabus.metadatamanager
Output Event DetailType: orcabus.librarystatechange
Output Event status: libraryrunidregistered

  • The UpdateDataBaseOnNewSampleSheet Construct
    • Subscribes to the BCLConvertManagerEventHandler Stack outputs and updates the database:
      • Registers all library run ids in the samplesheet
      • Appends libraryrunids to the library ids in the samplesheet
      • For a given library id, queries the current athena database to collect metadata for the library
        • assay
        • type
        • workflow etc.

Construct 1c 🚧

Input Event Source: orcabus.workflowrunmanager
Input Event DetailType: orcabus.workflowrunstatechange
Input Event status: complete

Output Event source: orcabus.bclconvertmanagerinputeventglue
Output Event DetailType: orcabus.workflowrunstatechange
Output Event status: complete

  • The BsshFastqCopyManagerInputMaker Construct
    • Subscribes to the BCLConvertManagerEventHandler Stack outputs and creates the input for the BSSHFastqCopyManager
    • Pushes an event payload of the input for the BsshFastqCopyManagerReadyEventSubmitter

Construct 1d ✅

Input Event Source: orcabus.bsshfastqcopymanagerinputeventglue
Input Event DetailType: orcabus.workflowrunstatechange
Input Event status: complete

Output Event source: orcabus.workflowrunmanager
Output Event DetailType: orcabus.workflowrunstatechange
Output Event status: ready

  • The BsshFastqCopyManagerReadyEventSubmitter Construct
    • Subscribes to the BCLConvertManagerEventHandler Stack outputs and generates a ready event for the BSSHFastqCopyManager

Note the image below will reflect what's done overall by this stack. It does not reflect the event communication between services

image

Part 2 - Glue the BSSHFastqCopyManager to BCLConvertInteropQC 🚧

This will be all one construct

This construct will be known as Selleys.

Construct 2a 🚧

Input Event Source: orcabus.bsshfastqcopymanager
Input Event DetailType: orcabus.workflowrunstatechange
Input Event status: succeeded

Output Event source: orcabus.workflowrunmanager
Output Event DetailType: orcabus.workflowrunstatechange
Output Event status: complete

  • The BSSHFastqCopyManagerEventHandler Construct
    • This will be triggered by the completion event from the BSSHFastqCopyManager Construct.
    • Contains a standard workflow run statechange, the fastqlistrowgzipped, and instrument run id
    • Pushes a workflow run manager event saying that the BSSHFastqCopyManager has complete.

Construct 2b 🚧

Input Event Source: orcabus.workflowrunmanager
Input Event DetailType: orcabus.workflowrunstatechange
Input Event status: complete

Output Event source: orcabus.metadatamanager
Output Event DetailType: orcabus.librarystatechange
Output Event status: fastqlistrowregistered

  • The UpdateDataBaseOnNewFastqListRows Construct
    • Subscribes to the BSSHFastqCopyManagerEventHandler Construct outputs and updates the database:
      • Registers all fastq list rows in the database and tie them to the libraryrunid
      • Appends libraryrunids to the library ids in the samplesheet
      • Pushes an event to say that some fastq list rows have been added to the database, with a list of affected library ids and the instrument run id

Construct 2c 🚧

Input Event Source: orcabus.workflowrunmanager
Input Event DetailType: orcabus.workflowrunstatechange
Input Event status: complete

Output Event source: orcabus.bclconvertinteropqcinputeventglue
Output Event DetailType: orcabus.workflowrunstatechange
Output Event status: complete

  • The BCLConvertInteropQCInputMaker Construct
    • Subscribes to the BSSHFastqCopyManagerEventHandler Construct outputs and creates the input for the BCLConvertInteropQC
    • Pushes an event payload of the input for the BCLConvertInteropQCReadyEventSubmitter

Construct 2d 🚧

Input Event Source: orcabus.bclconvertinteropqcinputeventglue
Input Event DetailType: orcabus.workflowrunstatechange
Input Event status: complete

Output Event source: orcabus.workflowrunmanager
Output Event DetailType: orcabus.workflowrunstatechange
Output Event status: ready

  • The BCLConvertInteropQCReadyEventSubmitter Construct
    • Subscribes to the BSSHFastqCopyManagerEventHandler Construct outputs and generates a ready event for the BCLConvertInteropQC

Note the image below will reflect what's done overall by this stack. It does not reflect the event communication between services

image

Part 3 - Glue the FastqListRow Output Event to the ctTSOv2ReadySfn 🚧

This will be all one stack

The most important glue of them all. Gorilla Glue!

Construct 3a 🚧

Input Event Source: orcabus.metadatamanager
Input Event DetailType: orcabus.librarystatechange
Input Event status: fastqlistrowregistered

Output Event source: orcabus.workflowrunmanager
Output Event DetailType: orcabus.librarystatechange
Output Event status: fastqlistrowsregistered

  • The FastqListRowEventHandler Construct
    • This will be triggered by the completion event from the UpdateDataBaseOnNewFastqListRows complete event.
    • Contains a standard workflow run statechange
    • And a list of fastq list rows / library ids that have changed, and the instrument run id

Construct 3b 🚧

Input Event source: orcabus.workflowrunmanager
Input Event DetailType: orcabus.librarystatechange
Input Event status: fastqlistrowsregistered

Output Event source: orcabus.cttsov2inputeventglue
Output Event DetailType: orcabus.workflowrunstatechange
Output Event status: complete

  • The ctTSOv2InputMaker Construct
    • Subscribes to the FastqListRowEventHandler Construct outputs and creates the input for the ctTSOv2ReadySfn
    • Pushes an event payload of the input for the ctTSOv2ReadyEventSubmitter

Construct 3c 🚧

Output Event source: orcabus.cttsov2inputeventglue
Output Event DetailType: orcabus.workflowrunstatechange
Output Event status: complete

Output Event source: orcabus.workflowrunmanager
Output Event DetailType: orcabus.workflowrunstatechange
Output Event status: ready

  • The ctTSOv2ReadyEventSubmitter Construct
    • Subscribes to the ctTSOv2InputMaker Construct outputs and generates a ready event for the ctTSOv2ReadySfn

Note the image below will reflect what's done overall by this stack. It does not reflect the event communication between services
We are also yet to discuss the WGS Alignment QC service

image

Notes

alexiswl and others added 16 commits May 15, 2024 09:41
Generate secrets, ssm parameters, table objects, outside of construct (inside stack instead), use grantRead etc rather than create our own policy statements.
Still a massive WIP, a lot of room for improvement too.

At the moment, we have four step functions for each service

First three are involved in the launch stage:

* one wrapper than handles ready events from workflow manager, then invokes second step function to generate the inputs json
* The second step function generates the inputs json from the payload + any other extra things required, in the case of cttso, this might mean copying files around so that they're in the correct format, for most CWL pipelines, this should be a reasonably straightforward configuration
* The final step function then launches the icav2 workflow and writes the analysis id to the database

* We then have a fourth step function that monitors any workflow state changes from ICAv2 and writes them to the database and then launches an internal event.
Updated handle event change sfn (wrong template was copied)

Various sfn fixes

Added readmes

Updated cttso sfn to just do the copy and samplesheet creation, and generate the inputs json. Let the sfn do the pipeline launching and handling
Not a trivial process since AWS Step functions makes it difficult to evalutate strings in a list. Instead need to make them dictionaries and then collect only the values hence the second step above is required.
Refactor bssh and cttso v2 so each service generates its own icav2 copy file service

See #293 for more info
Update output directory, to just cache path / run id / portal run id (which is how it is in icav1)
AWS Step Functions template detail type and source should be set in the inputs.
…r-event-subscription

Add Events system to bssh fastq copy manager (and deprecate icav2 copy batch utility stack)
* icav2 event translator / now bclconvert manager
* Move workflowrunstatechange into its own construct
* TypeHint workflow run state change object, need to do a bit more testing on this first
* Add samplesheet outputs and run info collection into icav2 copy command
Components:
* Event relayer for workflowRunManager to submit ready events
* Initialised stacky-mcstackface mock manager
* Comprises four main components
@alexiswl alexiswl marked this pull request as draft May 17, 2024 07:17
@alexiswl
Copy link
Member Author

@victorskl @reisingerf First step function templates available in readme for first step (scotch): https://github.com/umccr/orcabus/tree/feature/stacky-mcstackface/lib/workload/stateless/stacks/stacky-mcstackface/glue-constructs/scotch

@alexiswl
Copy link
Member Author

alexiswl commented May 22, 2024

One discussion for tomorrow is merging parts 1 and 2 of the 'scotch' events (see readme above). This discussion is also going to be relevant for the Selleys events as well (post bsshfastqcopy).

In the prototype setup above we have 'hey the bclconvert manager is complete (p1)', another service subscribing to say 'hey let me add this to the databases (p2)', and other simultaneously saying 'let me trigger this downstream service (copy bssh fastqs) (p3)', hoping that the former event (p2) finishes writing to databases before the downstream services finishes and another event tries to link the bssh fastqs to the library ids in the run.

In my opinion, external-to-internal events i.e bclconvertmanager source with 'complete' status, to workflowrunmanager with status 'complete' for bclconvert manager should be more than a simple event 'parse'.

When the workflowrunmanager submits an event saying that the bclconvert manager is complete, that should signal to other services subscribing to the workflow run manager event, 'hey the bclconvert manager is complete AND I've successfully imported the required information AND you can query my databases to find out more of that information'! i.e what libraries were on the run, what does the samplesheet comprise etc. These don't need to be part of the event that's raised by the event manager, it can still just parse the event from the bclconvert manager as is albeit with a different source attribute.

The second component (selleys) comprises ingesting the fastq list rows from the bsshfastqcopy output event and parsing as a workflowrunmanager event (p1), matching those fastq list rows with the library lane ids in the database (part 2), and launching the bclconvert interop qc (part 3 + 4).

I would prefer to have the cttsov2 be triggered from the completion of the bsshfastqcopymanager (p1) rather from a different source altogether (currently triggered from the libraryrunmanager fastqlistrows registsred), but then we have a conundrum since the databases may not contain the information needed for the input makers / glue to work correctly (getting into race-condition territory).

I know that this is early days and just prototying, but I think it's good to consider the principles that this system should follow

@alexiswl
Copy link
Member Author

@alexiswl
Copy link
Member Author

alexiswl added 5 commits May 24, 2024 17:10
Added the following 'global' constructs:

* event-workflowmanager-workflowrunstatechange-parse-external-event-detail

* event-workflowrunstatechange-internal-to-inputmaker-sfn

* lambda-b64gz-translator

* lambda-uuid7-generator
Connect the bsshfastqcopy outputs to the bclconvert interop qc pipeline
@victorskl victorskl added feature New feature investigation Look into how best to approach the problem epic labels May 29, 2024
alexiswl added 2 commits May 30, 2024 22:33
* Name state-machines, easier to find things
* Use ssm parameters with placeholders for paths (all icav2 services use the same analysis output ssm)
* Add workflow run name to list of tables
@alexiswl
Copy link
Member Author

Superseded by #337

@alexiswl alexiswl closed this May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic feature New feature investigation Look into how best to approach the problem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate a rogue workflow manager run stack (while the proper wfm is built)
2 participants