Skip to content

Commit

Permalink
Merge branch 'feat/srm-handle-icav2-event' into feat/srm-sequencerun-…
Browse files Browse the repository at this point in the history
…comments-module
  • Loading branch information
raylrui committed Dec 4, 2024
2 parents 1b99ea9 + a1a13e9 commit 825bb0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class SequenceRunManagerStack extends Stack {
*/
const procSqsFn = this.createPythonFunction('ProcHandler', {
index: 'sequence_run_manager_proc/lambdas/bssh_event.py',
handler: 'sqs_handler',
handler: 'event_handler',
timeout: Duration.minutes(2),
memorySize: 512,
reservedConcurrentExecutions: 1,
Expand All @@ -146,9 +146,12 @@ export class SequenceRunManagerStack extends Stack {

private setupEventRule(fn: aws_lambda.Function) {
/**
* For
*/
* For sequence run manager, we are using orcabus events ( source from BSSH ENS event pipe) to trigger the lambda function.
* event rule to filter the events that we are interested in.
* event pattern: see below
* process lambda will record the event to the database, and emit the 'SequenceRunStateChange' event to the event bus.
*
*/
const eventRule = new Rule(this, this.stackName + 'EventRule', {
ruleName: this.stackName + 'EventRule',
description: 'Rule to send {event_type.value} events to the {handler.function_name} Lambda',
Expand All @@ -158,11 +161,12 @@ export class SequenceRunManagerStack extends Stack {
detailType: ['Event from aws:sqs'],
detail: {
'ica-event': {
// only for mandatory fields
// mandatory fields (gdsFolderPath, gdsVolumeName(starts with bssh), instrumentRunId, dateModified)
gdsFolderPath: [{ exists: true }],
gdsVolumeName: [{ prefix: 'bssh' }],
instrumentRunId: [{ exists: true }],
dateModified: [{ exists: true }],

// optional fields (flowcell barcode, sample sheet name, reagent barcode, ica project id, api url, name)
acl: [{ prefix: 'wid:' }, { prefix: 'tid:' }],
id: [{ exists: true }],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def event_handler(event, context):
sequence_domain: SequenceDomain = (
sequence_srv.create_or_update_sequence_from_bssh_event(event_details)
)
entry = None

# Detect SequenceRunStateChange
if sequence_domain.state_has_changed:
Expand Down

0 comments on commit 825bb0c

Please sign in to comment.