Skip to content

Commit

Permalink
Added event target being the State Machine
Browse files Browse the repository at this point in the history
  • Loading branch information
alexiswl committed Apr 18, 2024
1 parent daa9cce commit e711fec
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/workload/stateless/bs_runs_upload_manager/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ The two steps of the statemachine are:
1. Generate a V2 Samplesheet and reupload it
2. Launch an ICAv1 tes task that runs the bs runs upload command

This statemachine will subscribe to the orcabus.srm events and trigger the statemachine when a new run is detected.

![](images/bs_runs_upload_manager.png)

## Inputs
Expand Down Expand Up @@ -95,4 +97,16 @@ This lambda will launch a tes task that will run the bs runs upload command.
{
"task_run_id": "trn.4fd3414f98fe47c3a6cfc31a67b7418a"
}
```
```

#### External parameters

The following properites are required in order to deploy the statemachine / stack:

* SecretsManager:
* ICA Access Token: `IcaSecretsPortal`
* Portal Token: `orcabus/token-service-jwt`
* BaseSpace Token Secret ID: `/manual/BaseSpaceAccessTokenSecret`
* Strings
* gds system files path root (where to do the TES logs go?)
* EventBus Name: `OrcabusMain`
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as iam from 'aws-cdk-lib/aws-iam';
import * as sfn from 'aws-cdk-lib/aws-stepfunctions';
import * as events from 'aws-cdk-lib/aws-events';
import * as events_targets from 'aws-cdk-lib/aws-events-targets';
import { DefinitionBody } from 'aws-cdk-lib/aws-stepfunctions';
import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager';
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
Expand Down Expand Up @@ -138,6 +139,16 @@ export class BsRunsUploadManagerConstruct extends Construct {
},
});

// Add target of event to be the state machine
rule.addTarget(
new events_targets.SfnStateMachine(
stateMachine,
{
input: events.RuleTargetInput.fromEventPath('$.detail')
}
)
)

// Set outputs
this.bs_runs_upload_event_state_machine_arn = stateMachine.stateMachineArn;
}
Expand Down

0 comments on commit e711fec

Please sign in to comment.