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

Stacky updates for generating umccrise events #505

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ export const mockInputMakerTableName = 'stacky-input-maker-table';
export const mockCttsov2InputGlueTableName = 'stacky-cttsov2-workflow-glue-table';
export const mockWgtsQcGlueTableName = 'stacky-wgts-qc-glue-table';
export const mockTnGlueTableName = 'stacky-tn-glue-table';

export const mockWtsGlueTableName = 'stacky-wts-glue-table';
export const mockUmccriseGlueTableName = 'stacky-umccrise-glue-table';

export const mockWorkflowManagerTableName = 'stacky-workflow-manager-table';

Expand Down
3 changes: 3 additions & 0 deletions config/stacks/stackyMcStackFace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
AppStage,
mockTnGlueTableName,
mockWtsGlueTableName,
mockUmccriseGlueTableName,
} from '../constants';
import { GlueStackConfig } from '../../lib/workload/stateless/stacks/stacky-mcstackface/glue-constructs';
import { StackyStatefulTablesConfig } from '../../lib/workload/stateful/stacks/stacky-mcstackface-dynamodb';
Expand All @@ -36,6 +37,7 @@ export const getGlueStackProps = (stage: AppStage): GlueStackConfig => {
wgtsQcGlueTableName: mockWgtsQcGlueTableName,
tnGlueTableName: mockTnGlueTableName,
wtsGlueTableName: mockWtsGlueTableName,
umccriseGlueTableName: mockUmccriseGlueTableName,
/* Secrets */
icav2AccessTokenSecretName: icav2AccessTokenSecretName[stage],
};
Expand All @@ -50,5 +52,6 @@ export const getStatefulGlueStackProps = (): StackyStatefulTablesConfig => {
dynamodbWgtsQcGlueTableName: mockWgtsQcGlueTableName,
dynamodbTnGlueTableName: mockTnGlueTableName,
dynamodbWtsGlueTableName: mockWtsGlueTableName,
dynamodbUmccriseGlueTableName: mockUmccriseGlueTableName,
};
};
10 changes: 10 additions & 0 deletions lib/workload/stateful/stacks/stacky-mcstackface-dynamodb/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface StackyStatefulTablesConfig {
dynamodbWgtsQcGlueTableName: string;
dynamodbTnGlueTableName: string;
dynamodbWtsGlueTableName: string;
dynamodbUmccriseGlueTableName: string;
removalPolicy?: RemovalPolicy;
}

Expand All @@ -25,6 +26,7 @@ export class StackyStatefulTablesStack extends Stack {
public readonly wgtsQcGlueTable: dynamodb.ITableV2;
public readonly tnGlueTable: dynamodb.ITableV2;
public readonly wtsGlueTable: dynamodb.ITableV2;
public readonly umccriseGlueTable: dynamodb.ITableV2;
constructor(scope: Construct, id: string, props: StackProps & StackyStatefulTablesStackProps) {
super(scope, id, props);

Expand Down Expand Up @@ -95,5 +97,13 @@ export class StackyStatefulTablesStack extends Stack {
tableName: props.dynamodbWtsGlueTableName,
removalPolicy: props.removalPolicy,
}).tableObj;

/*
Initialise dynamodb table for the umccrise glue service
*/
this.umccriseGlueTable = new DynamodbPartitionedPipelineConstruct(this, 'umccriseGlueTable', {
tableName: props.dynamodbUmccriseGlueTableName,
removalPolicy: props.removalPolicy,
}).tableObj;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Cttsov2GlueHandlerConstruct } from './jb-weld';
import { WgtsQcGlueHandlerConstruct } from './kwik';
import { TnGlueHandlerConstruct } from './loctite';
import { WtsGlueHandlerConstruct } from './mod-podge';
import { UmccriseGlueHandlerConstruct } from './pva';

/*
Provide the glue to get from the bclconvertmanager success event
Expand All @@ -28,6 +29,7 @@ export interface GlueConstructProps {
wgtsQcGlueTableObj: dynamodb.ITableV2;
tnGlueTableObj: dynamodb.ITableV2;
wtsGlueTableObj: dynamodb.ITableV2;
umccriseGlueTableObj: dynamodb.ITableV2;
/* SSM Parameters */
icav2ProjectIdSsmParameterObj: ssm.IStringParameter;
bsshOutputFastqCopyOutputUriSsmParameterObj: ssm.IStringParameter;
Expand All @@ -43,8 +45,8 @@ export class GlueConstruct extends Construct {
super(scope, id);

/*
Part A: Send 'showered' events if a new samplesheet arrives or new fastq list rows arrive
*/
Part A: Send 'showered' events if a new samplesheet arrives or new fastq list rows arrive
*/
const clag = new showerGlueHandlerConstruct(this, 'clag', {
/* Event Bus */
eventBusObj: props.eventBusObj,
Expand All @@ -67,8 +69,8 @@ export class GlueConstruct extends Construct {
});

/*
Part C: Connect the bclconvert interop qc
*/
Part C: Connect the bclconvert interop qc
*/
const gorilla = new BsshFastqCopyToBclconvertInteropQcConstruct(this, 'gorilla', {
/* Event Objects */
eventBusObj: props.eventBusObj,
Expand Down Expand Up @@ -101,8 +103,8 @@ export class GlueConstruct extends Construct {
});

/*
Part E: Plumber-up the WGTS QC Execution Service to the shower services
*/
Part E: Plumber-up the WGTS QC Execution Service to the shower services
*/
const kwik = new WgtsQcGlueHandlerConstruct(this, 'kwik', {
/* Event Bus */
eventBusObj: props.eventBusObj,
Expand Down Expand Up @@ -153,6 +155,24 @@ export class GlueConstruct extends Construct {
/* Secrets */
icav2AccessTokenSecretObj: props.icav2AccessTokenSecretObj,
});

/*
Part H: Plumber-up the UMCCRise Execution Service to the shower services
*/
const pva = new UmccriseGlueHandlerConstruct(this, 'pva', {
/* Event Bus */
eventBusObj: props.eventBusObj,
/* Tables */
inputMakerTableObj: props.inputMakerTableObj,
umccriseGlueTableObj: props.umccriseGlueTableObj,
/* SSM Parameters */
icav2ProjectIdSsmParameterObj: props.icav2ProjectIdSsmParameterObj,
analysisOutputUriSsmParameterObj: props.analysisOutputUriSsmParameterObj,
analysisLogsUriSsmParameterObj: props.analysisLogsUriSsmParameterObj,
analysisCacheUriSsmParameterObj: props.analysisCacheUriSsmParameterObj,
/* Secrets */
icav2AccessTokenSecretObj: props.icav2AccessTokenSecretObj,
});
}
}

Expand All @@ -167,6 +187,7 @@ export interface GlueStackConfig {
wgtsQcGlueTableName: string;
tnGlueTableName: string;
wtsGlueTableName: string;
umccriseGlueTableName: string;
/* SSM Parameters */
icav2ProjectIdSsmParameterName: string;
bsshOutputFastqCopyUriSsmParameterName: string;
Expand Down Expand Up @@ -230,6 +251,11 @@ export class GlueStack extends cdk.Stack {
'wtsGlueTableObj',
props.wtsGlueTableName
);
const umccriseGlueTableObj = dynamodb.Table.fromTableName(
this,
'umccriseGlueTableObj',
props.umccriseGlueTableName
);

/*
Get the SSM Parameters
Expand Down Expand Up @@ -285,6 +311,7 @@ export class GlueStack extends cdk.Stack {
cttsov2GlueTableObj: cttsov2GlueTableObj,
tnGlueTableObj: tnGlueTableObj,
wtsGlueTableObj: wtsGlueTableObj,
umccriseGlueTableObj: umccriseGlueTableObj,
/* SSM Parameters */
icav2ProjectIdSsmParameterObj: icav2ProjectIdSsmParameterObj,
bsshOutputFastqCopyOutputUriSsmParameterObj: bsshOutputFastqCopyUriSsmParameterObj,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def handler(event, context) -> Dict:
:param event: event object
:return: draft event payload
"""
subject_id = event['subject_id']

tumor_library_id = event['tumor_library_id']
normal_library_id = event['normal_library_id']
Expand All @@ -52,8 +53,9 @@ def handler(event, context) -> Dict:
"dragenReferenceVersion": DEFAULT_DRAGEN_REFERENCE_VERSION
},
"event_tags": {
"subjectId": subject_id,
"tumorLibraryId": tumor_library_id,
"normalLibrary_id": normal_library_id,
"normalLibraryId": normal_library_id,
"tumorFastqListRowIds": tumor_fastq_list_row_ids,
"normalFastqListRowIds": fastq_list_row_ids
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@
"Parameters": {
"FunctionName": "${__generate_draft_event_payload_lambda_function_arn__}",
"Payload": {
"subject_id.$": "$.get_library_item_step.Item.subject_id.S",
"tumor_library_id.$": "$.get_tn_pair_step.tumor_library.id",
"normal_library_id.$": "$.get_tn_pair_step.normal_library.id",
"tumor_fastq_list_rows.$": "$.get_parameters_step.tumor_fastq_list_rows",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#!/usr/bin/env python3


# Set the fastq list rows

# Set the output file prefix

#!/usr/bin/env python3

"""
Generate draft event payload for the event

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@
"ResultPath": "$.generate_draft_event_payload_data_step",
"Next": "Push WTS Draft Event",
"ResultSelector": {
"input_event_data.$": "$.Payload.input_event_data"
"input_event_data.$": "$.Payload.input_event_data",
"event_tags.$": "$.Payload.event_tags"
}
},
"Push WTS Draft Event": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import { Construct } from 'constructs';
import * as events from 'aws-cdk-lib/aws-events';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as ssm from 'aws-cdk-lib/aws-ssm';
import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager';
import { UmccriseInitialiseSubjectDbRowConstruct } from './part_1/initialise-umccrise-subject-dbs';
import { UmccriseInitialiseLibraryAndFastqListRowConstruct } from './part_2/initialise-umccrise-library-dbs';
import { UmccrisePopulateFastqListRowConstruct } from './part_3/update-fastq-list-rows-dbs';
import { TnCompleteToUmccriseDraftConstruct } from './part_4/tn-complete-to-umccrise-draft';
import { UmccriseInputMakerConstruct } from './part_5/umccrise-draft-to-ready';

/*
Provide the glue to get from the bssh fastq copy manager to submitting wgts qc analyses
*/

export interface umccriseGlueHandlerConstructProps {
/* General */
eventBusObj: events.IEventBus;
/* Tables */
umccriseGlueTableObj: dynamodb.ITableV2;
inputMakerTableObj: dynamodb.ITableV2;
/* SSM Parameters */
analysisOutputUriSsmParameterObj: ssm.IStringParameter;
analysisLogsUriSsmParameterObj: ssm.IStringParameter;
analysisCacheUriSsmParameterObj: ssm.IStringParameter;
icav2ProjectIdSsmParameterObj: ssm.IStringParameter;
/* Secrets */
icav2AccessTokenSecretObj: secretsManager.ISecret;
}

export class UmccriseGlueHandlerConstruct extends Construct {
constructor(scope: Construct, id: string, props: umccriseGlueHandlerConstructProps) {
super(scope, id);

/*
Part 1

Input Event Source: `orcabus.instrumentrunmanager`
Input Event DetailType: `SamplesheetMetadataUnion`
Input Event status: `SubjectInSamplesheet`

* Initialise umccrise instrument db construct
*/
const umccrise_initialise_subject = new UmccriseInitialiseSubjectDbRowConstruct(
this,
'umccrise_initialise_subject',
{
eventBusObj: props.eventBusObj,
tableObj: props.umccriseGlueTableObj,
}
);

/*
Part 2

Input Event Source: `orcabus.instrumentrunmanager`
Input Event DetailType: `SamplesheetMetadataUnion`
Input Event status: `LibraryInSamplesheet`

* Initialise umccrise instrument db construct
*/
const umccrise_initialise_library_and_fastq_list_row =
new UmccriseInitialiseLibraryAndFastqListRowConstruct(
this,
'umccrise_initialise_library_and_fastq_list_row',
{
eventBusObj: props.eventBusObj,
tableObj: props.umccriseGlueTableObj,
}
);

/*
Part 3

Input Event Source: `orcabus.instrumentrunmanager`
Input Event DetailType: `FastqListRowStateChange`
Input Event status: `newFastqListRow`

* Populate the fastq list row attributes for the rgid for this workflow
*/

const umccrise_populate_fastq_list_row = new UmccrisePopulateFastqListRowConstruct(
this,
'umccrise_populate_fastq_list_row',
{
eventBusObj: props.eventBusObj,
tableObj: props.umccriseGlueTableObj,
}
);

/*
Part 4

Input Event Source: `orcabus.workflowmanager`
Input Event DetailType: `WorkflowRunStateChange`
Input Event status: `succeeded`

Output Event source: `orcabus.umccriseinputeventglue`
Output Event DetailType: `WorkflowDraftRunStateChange`
Output Event status: `draft`

* Populate the fastq list row attributes for the rgid for this workflow
*/

const tn_to_umccrise_draft = new TnCompleteToUmccriseDraftConstruct(
this,
'tn_to_umccrise_draft',
{
eventBusObj: props.eventBusObj,
tableObj: props.umccriseGlueTableObj,
workflowsTableObj: props.inputMakerTableObj,
}
);

/*
Part 5

Input Event source: `orcabus.umccriseinputeventglue`
Input Event DetailType: `WorkflowDraftRunStateChange`
Input Event status: `draft`

Output Event source: `orcabus.umccriseinputeventglue`
Output Event DetailType: `WorkflowRunStateChange`
Output Event status: `ready`

* The umccriseInputMaker, subscribes to the umccrise input event glue (itself) and generates a ready event for the umccriseReadySfn
* However, in order to be 'ready' we need to use a few more variables such as
* icaLogsUri,
* analysisOutputUri
* cacheUri
* projectId
* userReference
*/
const umccriseInputMaker = new UmccriseInputMakerConstruct(this, 'fastq_list_row_qc_complete', {
/* Event bus */
eventBusObj: props.eventBusObj,
/* Tables */
inputMakerTableObj: props.inputMakerTableObj,
/* SSM Param objects */
icav2ProjectIdSsmParameterObj: props.icav2ProjectIdSsmParameterObj,
outputUriSsmParameterObj: props.analysisOutputUriSsmParameterObj,
cacheUriSsmParameterObj: props.analysisCacheUriSsmParameterObj,
logsUriSsmParameterObj: props.analysisLogsUriSsmParameterObj,
/* Secrets Manager */
icav2AccessTokenSecretObj: props.icav2AccessTokenSecretObj,
});
}
}
Loading