Skip to content

Commit

Permalink
Prettified and updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
alexiswl committed Apr 18, 2024
1 parent 2be1f3d commit d9cf223
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

const ROOT_SSM_PARAMETER_PATH = "/umccr/orcabus/stateful/cttso_v2_pipeline_dynamo_db";
const ROOT_SSM_PARAMETER_PATH = '/umccr/orcabus/stateful/cttso_v2_pipeline_dynamo_db';

export const DYNAMODB_TABLE_ARN_SSM_PARAMETER_PATH = `${ROOT_SSM_PARAMETER_PATH}/analysis_table_arn`;
export const DYNAMODB_TABLE_NAME_SSM_PARAMETER_PATH = `${ROOT_SSM_PARAMETER_PATH}/analysis_table_name`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module.exports = {
roots: ['<rootDir>/test'],
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.tsx?$': 'ts-jest'
}
'^.+\\.tsx?$': 'ts-jest',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
"constructs": "^10.0.0",
"source-map-support": "^0.5.21"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
// example test. To run these tests, uncomment this file along with the
// example resource in lib/cttso_v2_launch_stack.ts
test('SQS Queue Created', () => {
// const app = new cdk.App();
// // WHEN
// const stack = new Deploy.DeployStack(app, 'MyTestStack');
// // THEN
// const template = Template.fromStack(stack);

// template.hasResourceProperties('AWS::SQS::Queue', {
// VisibilityTimeout: 300
// });
// const app = new cdk.App();
// // WHEN
// const stack = new Deploy.DeployStack(app, 'MyTestStack');
// // THEN
// const template = Template.fromStack(stack);
// template.hasResourceProperties('AWS::SQS::Queue', {
// VisibilityTimeout: 300
// });
});
11 changes: 6 additions & 5 deletions lib/workload/stateless/cttso_v2_pipeline_manager/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ The AWS Step functions takes in the following parameters:
* samplesheet_b64gz: (a base64 encoded and gzipped samplesheet as a dictionary, this can be found as an output of the bssh_icav2_fastq_copy_manager step functions)
* fastq_list_rows_b64gz: (a base64 encoded and gzipped list of fastq rows as a dictionary, this can be found as an output of the bssh_icav2_fastq_copy_manager step functions)
* This will use only the fastq files whose RGSM attribute match the sample id
* cache_uri: Uri to the cache directory (where the fastq files are copied over to)
* output_uri: Uri to the output directory

### Example Input

Expand All @@ -60,7 +62,9 @@ The AWS Step functions takes in the following parameters:
"project_name": "testing"
},
"samplesheet_b64gz": "H4sIAAAAAAAAA91b227bOBB9z1cU3tek0M2WlD5pVUAo0M0uGvahWCwGsq20Qm3ZlZV0i0X/fTmUGcvlULQVxmiNIAEcUuKZIefqw/8uXrwYfSryeVGPrl/8xz/xz3flooC7Vb3MG3go6k25qvigd9mO1vcVVPmy4P8asc2X6uqmmL67STzfdV3/6o+3RXHL3oE7uVk9eP5o+1BZbZr6fllUDTTf1uJZPp7fFl9GfMJ3nDWqOYzNDgV+BBdm32aLAv/tjt3LzohHjZTVvPh37yFnb6T7kPO48HS2mK0qLmkDm6JpyupjB8ayrMrl/RKaulwuizmIxRdF9bH5xCf548v9afk8XzdFDSv+ukW+xilyRr75DJtPK76KlPTx6c3qrvma10VH3aPgpfcyHFEg53mT8xl/i2dbmHzCIq9Qr1tV4Evz5ZpvZDnHt731fMf1J9HocVhoBIeyJGVZkrEk+2HQw9GUjyYsTZJ0N4rC1eW82Glz9D68cT+4gf/qjeuIX/mP3VNSNe3GinezjKX8hy+Q8HX4Mkwz3dNNF7O/Xw5QRUyogmshTbg+soRSBS6fcRAZOy9VhA6hijTlJ4KvwlJKFXzJjIkJZ6YKlzQQPBbcPkgDSTJ+KHDhMzOQ0KNOBWMoLF+B9BV8mB+bLDk3A/HJU4E7n+3te/dU8PPCJ6S/noF4faoIJvzNPAUgnWfrPemzgUGEsf0ocxYKCbUKScUyfBGm8RtMxNbkzBQS6U8Idw+oD02mwZfm54db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Es2s3bBRPNe5f1EGRXAolufQGuLMRQjIpmhfJEXFjISHcrelGh+I+uXMskyRXQkmuvDH2JhNCMimaF8kRcWMhIXyCAvs17d0scDfenyK5Fkpy7Q1wpxJCMimaF8kRcWMh4cibLHGuP/Z4YXJt6dp1I5TkxhvgTi2EZFI0L5Ij4sZCwpEJvfh66TbFyrUrYhMkm0wmySbzBrjTyCCZFs2K5Ji4sZAQnrHppnfdTRrovvE82Qjt8TLKG+BOIT1etGheJEfEjYWE8Jss8SyUO9VoXb8XSbLQHi+jvQHuFNLjRYvmRXJE3FhICK7Jbs5Aa3EiX+teg0WRLLTHyxhvgDuF9HjRonmRHBE3FhKOnGp0b5TGd1hY9zILimShPV7mYIA7hfR40aJ5kRwRNxYSwj1e1p1nTLFT07b082QjtMfLFN4Adwrp8aJF8yI5Im4sJIT7rocOpw2kbt4AtogQJOdC1+T8YIA7hfR40aJZkRwTNxYSHjdbM4+erXlyJBMDDk+fZFo0K5Jj4sZCwuMm8uXRE/lOjmRiLNrpk0yLZkVyTNxYSDhSu7buBAU+Vbb4giiKZKHZdXMwxj6XQjIpmhfJEXFjIeE+yb/+C4TOMeRCoAAA", /* pragma: allowlist secret */
"cache_uri": "icav2://7595e8f2-32d3-4c76-a324-c6a85dae87b5/ilmn_cttso_fastq_cache/20240308abcd1234/L2301368_run_cache/",
"output_uri": "icav2://7595e8f2-32d3-4c76-a324-c6a85dae87b5/ilmn_cttso_outputs/v2_1_1/20240308abcd1234/"
}
```

Expand Down Expand Up @@ -162,9 +166,6 @@ Take the fastq output locations, samplesheet location and metadata generated in
### External Parameters required by CDK

```
/icav2/umccr-prod/service-user-trial-jwt-token-secret-arn
/icav2_copy_batch_utility/state_machine_arn_batch
/icav2/umccr-prod/cache_project_cttso_fastq_path
/icav2/umccr-prod/output_project_cttso_fastq_path
/icav2/umccr-prod/tso500_ctdna_2.1_pipeline_id
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
CTTSO_V2_LAUNCH_STATE_MACHINE_NAME_SSM_PARAMETER_PATH,
DYNAMODB_TABLE_NAME_SSM_PARAMETER_PATH,
ICAV2_ACCESS_TOKEN_SECRET_ID,
ICAV2_COPY_BATCH_UTILITY_STATE_MACHINE_NAME_SSM_PARAMETER_PATH,
ICAV2_COPY_BATCH_UTILITY_STATE_MACHINE_NAME_SSM_PARAMETER_PATH, ORCABUS_EVENT_NAME,
SSM_PARAMETER_LIST_FOR_CTTSO_LAUNCH_LAMBDAS,
} from '../constants';

Expand All @@ -19,6 +19,7 @@ new ctTSOV2LaunchStateMachineStack(app, 'ctTSOv2LaunchStatemachineStack', {
cttso_v2_launch_state_machine_arn_ssm_parameter_path: CTTSO_V2_LAUNCH_STATE_MACHINE_ARN_SSM_PARAMETER_PATH,
cttso_v2_launch_state_machine_name_ssm_parameter_path: CTTSO_V2_LAUNCH_STATE_MACHINE_NAME_SSM_PARAMETER_PATH,
dynamodb_table_ssm_parameter_path: DYNAMODB_TABLE_NAME_SSM_PARAMETER_PATH,
eventbus_name: ORCABUS_EVENT_NAME,
env: {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const ICAV2_COPY_BATCH_UTILITY_STATE_MACHINE_NAME_SSM_PARAMETER_PATH = "/
export const PIPELINE_ID_SSM_PARAMETER_PATH = "/icav2/umccr-prod/tso500_ctdna_2.1_pipeline_id"
export const CTTSO_V2_LAUNCH_STATE_MACHINE_ARN_SSM_PARAMETER_PATH = "/icav2/umccr-prod/cttso_launch_state_machine_arn"
export const CTTSO_V2_LAUNCH_STATE_MACHINE_NAME_SSM_PARAMETER_PATH = "/icav2/umccr-prod/cttso_launch_state_machine_name"

export const ORCABUS_EVENT_NAME = "OrcaBusMain"

export const SSM_PARAMETER_LIST_FOR_CTTSO_LAUNCH_LAMBDAS = [
PIPELINE_ID_SSM_PARAMETER_PATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as sfn from 'aws-cdk-lib/aws-stepfunctions';
import * as ssm from 'aws-cdk-lib/aws-ssm';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager'
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 { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
Expand All @@ -19,6 +21,7 @@ interface ctTSOv2LaunchStepFunctionConstructProps {
lambda_layer_obj: LambdaLayerConstruct,
icav2_copy_batch_state_machine_obj: sfn.IStateMachine,
ssm_parameter_obj_list: ssm.IStringParameter[]; // List of parameters the workflow session state machine will need access to
eventbus_obj: events.IEventBus;
/* Lambdas paths */
generate_db_uuid_lambda_path: string; // __dirname + '/../../../lambdas/generate_db_uuid'
generate_trimmed_samplesheet_lambda_path: string; // __dirname + '/../../../lambdas/generate_trimmed_samplesheet_lambda_path'
Expand Down Expand Up @@ -169,13 +172,18 @@ export class ctTSOv2LaunchStepFunctionStateMachineConstruct extends Construct {
definitionBody: DefinitionBody.fromFile(props.workflow_definition_body_path),
// definitionSubstitutions
definitionSubstitutions: {
/* Lambda arns */
'__generate_db_uuid__': generate_db_uuid_lambda_obj.functionArn,
'__launch_cttso_nextflow_pipeline__': launch_cttso_nextflow_pipeline_lambda_obj.functionArn,
'__generate_copy_manifest_dict__': generate_copy_manifest_dict_lambda_obj.functionArn,
'__generate_trimmed_samplesheet__': generate_trimmed_samplesheet_lambda_obj.functionArn,
'__upload_samplesheet_to_cache_dir__': upload_samplesheet_to_cache_dir_lambda_obj.functionArn,
/* Subfunction state machines */
'__copy_batch_data_state_machine_arn__': props.icav2_copy_batch_state_machine_obj.stateMachineArn,
'__table_name__': props.dynamodb_table_obj.tableName
/* Dynamodb tables */
'__table_name__': props.dynamodb_table_obj.tableName,
/* Event bus to push to */
'__eventbus_name__': props.eventbus_obj.eventBusName
},
});

Expand Down Expand Up @@ -222,6 +230,32 @@ export class ctTSOv2LaunchStepFunctionStateMachineConstruct extends Construct {
stateMachine.role
)

// Trigger state machine on event
const rule = new events.Rule(this, 'cttso_v2_launch_step_function_rule', {
eventBus: props.eventbus_obj,
eventPattern: {
source: ['orcabus.wfm'],
detailType: ['WorkflowRunStateChange'],
/*
FIXME - nothing is set in stone yet
*/
detail: {
status: ['ready_to_run'],
workflow: ['cttso_v2_launch'],
},
},
});

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

props.eventbus_obj.grantPutEventsTo(stateMachine.role);


// Set outputs
this.cttso_v2_launch_state_machine_name = stateMachine.stateMachineName;
this.cttso_v2_launch_state_machine_arn = stateMachine.stateMachineArn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as ssm from 'aws-cdk-lib/aws-ssm';
import * as sfn from 'aws-cdk-lib/aws-stepfunctions';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager';
import * as events from 'aws-cdk-lib/aws-events';
import { ctTSOv2LaunchStepFunctionStateMachineConstruct } from '../constructs/cttso_v2_launch_step_function';
import { LambdaLayerConstruct } from '../constructs/lambda_layer';

Expand All @@ -14,6 +15,7 @@ interface ctTSOV2LaunchStateMachineStackProps extends cdk.StackProps {
cttso_v2_launch_state_machine_arn_ssm_parameter_path: string;
cttso_v2_launch_state_machine_name_ssm_parameter_path: string;
dynamodb_table_ssm_parameter_path: string;
eventbus_name: string;
}

export class ctTSOV2LaunchStateMachineStack extends cdk.Stack {
Expand Down Expand Up @@ -73,6 +75,13 @@ export class ctTSOV2LaunchStateMachineStack extends cdk.Stack {
),
);

// Get event bus
const eventbus_obj = events.EventBus.fromEventBusName(
this,
'eventbus',
props.eventbus_name,
);

const cttso_v2_launch_state_machine = new ctTSOv2LaunchStepFunctionStateMachineConstruct(
this,
id,
Expand All @@ -83,14 +92,15 @@ export class ctTSOV2LaunchStateMachineStack extends cdk.Stack {
lambda_layer_obj: lambda_layer_obj,
icav2_copy_batch_state_machine_obj: icav2_copy_batch_stack_state_machine_obj,
ssm_parameter_obj_list: ssm_parameter_obj_list,
eventbus_obj: eventbus_obj,
/* Lambdas paths */
generate_db_uuid_lambda_path: __dirname + '/../../../lambdas/generate_db_uuid', // __dirname + '/../../../lambdas/generate_uuid'
generate_trimmed_samplesheet_lambda_path: __dirname + '/../../../lambdas/generate_and_trim_cttso_samplesheet_dict', // __dirname + '/../../../lambdas/generate_and_trim_cttso_samplesheet_dict'
upload_samplesheet_to_cache_dir_lambda_path: __dirname + '/../../../lambdas/upload_samplesheet_to_cache_dir', // __dirname + '/../../../lambdas/upload_samplesheet_to_cache_dir'
generate_copy_manifest_dict_lambda_path: __dirname + '/../../../lambdas/generate_copy_manifest_dict', // __dirname + '/../../../lambdas/generate_copy_manifest_dict'
launch_cttso_nextflow_pipeline_lambda_path: __dirname + '/../../../lambdas/launch_cttso_nextflow_pipeline', // __dirname + '../launch_cttso_nextflow_pipeline'
/* Step function templates */
workflow_definition_body_path: __dirname + '/../../../step_functions_templates/cttso_v2_launch_workflow_state_machine.json', // __dirname + '/../../../step_functions_templates/cttso_v2_launch_workflow_state_machine.json'
workflow_definition_body_path: __dirname + '/../../../step_functions_templates/cttso_v2_launch_workflow_state_machine.asl.json', // __dirname + '/../../../step_functions_templates/cttso_v2_launch_workflow_state_machine.asl.json'
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@
{
"Detail.$": "$.database_event_data",
"DetailType": "ctTSOv2StateChange",
"EventBusName": "OrcaBus",
"EventBusName": "${__eventbus_name__}",
"Source": "orcabus.cttso_v2",
"Resources": []
}
Expand Down

0 comments on commit d9cf223

Please sign in to comment.