Skip to content

Commit 38dc307

Browse files
committed
Add icav2 copy manager stack
ICAv2 sync fix
1 parent eaacb85 commit 38dc307

File tree

20 files changed

+1880
-0
lines changed

20 files changed

+1880
-0
lines changed

config/config.ts

+6
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ import {
7676
getFastqSyncManagerStackProps,
7777
getFastqSyncManagerTableStackProps,
7878
} from './stacks/fastqSyncManager';
79+
import {
80+
getIcav2DataCopyManagerStackProps,
81+
getIcav2DataCopyManagerTableStackProps,
82+
} from './stacks/icav2DataCopyManager';
7983

8084
interface EnvironmentConfig {
8185
name: string;
@@ -120,6 +124,7 @@ export const getEnvironmentConfig = (stage: AppStage): EnvironmentConfig | null
120124
fastqManagerTableStackProps: getFastqManagerTableStackProps(stage),
121125
fastqUnarchivingManagerTableStackProps: getFastqUnarchivingManagerTableStackProps(),
122126
fastqSyncManagerTableStackProps: getFastqSyncManagerTableStackProps(),
127+
icav2DataCopyTableStackProps: getIcav2DataCopyManagerTableStackProps(),
123128
},
124129
statelessConfig: {
125130
metadataManagerStackProps: getMetadataManagerStackProps(stage),
@@ -153,6 +158,7 @@ export const getEnvironmentConfig = (stage: AppStage): EnvironmentConfig | null
153158
fastqManagerStackProps: getFastqManagerStackProps(stage),
154159
fastqUnarchivingManagerStackProps: getFastqUnarchivingManagerStackProps(stage),
155160
fastqSyncManagerStackProps: getFastqSyncManagerStackProps(stage),
161+
icav2DataCopyManagerStackProps: getIcav2DataCopyManagerStackProps(stage),
156162
},
157163
};
158164

config/constants.ts

+7
Original file line numberDiff line numberDiff line change
@@ -971,3 +971,10 @@ export const fastqUnarchivingManagerEventSource = 'orcabus.fastqunarchivingmanag
971971
Fastq sync service
972972
*/
973973
export const fastqSyncEventDetailType = 'fastqSync';
974+
975+
/*
976+
ICAv2 ProjectData Copy Manager Stack
977+
*/
978+
export const icav2DataCopyManagerDynamodbTableName = 'icav2DataCopyManagerDynamoDBTable';
979+
export const icav2DataCopyEventSource = 'orcabus.icav2datacopymanager';
980+
export const icav2DataCopySyncDetailType = 'ICAv2DataCopySync';

config/stacks/icav2DataCopyManager.ts

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import {
2+
AppStage,
3+
eventBusName,
4+
icaEventPipeStackName,
5+
icav2AccessTokenSecretName,
6+
icav2DataCopyEventSource,
7+
icav2DataCopyManagerDynamodbTableName,
8+
icav2DataCopySyncDetailType,
9+
} from '../constants';
10+
import { Icav2DataCopyManagerTableConfig } from '../../lib/workload/stateful/stacks/icav2-data-copy-manager-dynamo-db/deploy';
11+
import { Icav2DataCopyManagerConfig } from '../../lib/workload/stateless/stacks/icav2-data-copy-manager/deploy/interfaces';
12+
13+
/*
14+
Internal constants
15+
*/
16+
const icav2DataCopyInternalDetailType = 'ICAv2DataCopyInternalSync';
17+
18+
// Stateful
19+
export const getIcav2DataCopyManagerTableStackProps = (): Icav2DataCopyManagerTableConfig => {
20+
return {
21+
dynamodbTableName: icav2DataCopyManagerDynamodbTableName,
22+
};
23+
};
24+
25+
// Stateless
26+
export const getIcav2DataCopyManagerStackProps = (stage: AppStage): Icav2DataCopyManagerConfig => {
27+
return {
28+
/*
29+
Tables
30+
*/
31+
dynamodbTableName: icav2DataCopyManagerDynamodbTableName,
32+
33+
/*
34+
Event handling
35+
*/
36+
eventBusName: eventBusName,
37+
icaEventPipeName: icaEventPipeStackName,
38+
eventSource: icav2DataCopyEventSource,
39+
eventExternalDetailType: icav2DataCopySyncDetailType,
40+
eventInternalDetailType: icav2DataCopyInternalDetailType,
41+
42+
/*
43+
Names for things
44+
*/
45+
stateMachinePrefix: 'icav2-data-copy',
46+
ruleNamePrefix: 'icav2-data-copy',
47+
48+
/*
49+
Secrets
50+
*/
51+
icav2AccessTokenSecretId: icav2AccessTokenSecretName[stage], // "/icav2/umccr-prod/service-production-jwt-token-secret-arn"
52+
};
53+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import * as cdk from 'aws-cdk-lib';
2+
import { Construct } from 'constructs';
3+
import { DynamodbPartitionedPipelineConstruct } from '../../../../components/dynamodb-partitioned-table';
4+
5+
export interface Icav2DataCopyManagerTableConfig {
6+
dynamodbTableName: string;
7+
}
8+
9+
export type Icav2DataCopyManagerTableStackProps = Icav2DataCopyManagerTableConfig & cdk.StackProps;
10+
11+
export class Icav2DataCopyManagerTable extends cdk.Stack {
12+
constructor(scope: Construct, id: string, props: Icav2DataCopyManagerTableStackProps) {
13+
super(scope, id, props);
14+
15+
/*
16+
Initialise dynamodb table with id and sort keys
17+
*/
18+
new DynamodbPartitionedPipelineConstruct(this, props.dynamodbTableName, {
19+
tableName: props.dynamodbTableName,
20+
});
21+
}
22+
}

lib/workload/stateful/statefulStackCollectionClass.ts

+14
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ import {
7878
FastqSyncManagerTable,
7979
FastqSyncManagerTableStackProps,
8080
} from './stacks/fastq-sync-dynamodb/deploy/stack';
81+
import {
82+
Icav2DataCopyManagerTable,
83+
Icav2DataCopyManagerTableStackProps,
84+
} from './stacks/icav2-data-copy-manager-dynamo-db/deploy';
8185

8286
export interface StatefulStackCollectionProps {
8387
dataBucketStackProps: DataBucketStackProps;
@@ -103,6 +107,7 @@ export interface StatefulStackCollectionProps {
103107
fastqManagerTableStackProps: FastqManagerTableStackProps;
104108
fastqUnarchivingManagerTableStackProps: FastqUnarchivingManagerTableStackProps;
105109
fastqSyncManagerTableStackProps: FastqSyncManagerTableStackProps;
110+
icav2DataCopyTableStackProps: Icav2DataCopyManagerTableStackProps;
106111
}
107112

108113
export class StatefulStackCollection {
@@ -131,6 +136,7 @@ export class StatefulStackCollection {
131136
readonly fastqManagerTableStack: Stack;
132137
readonly fastqUnarchivingManagerTableStack: Stack;
133138
readonly fastqSyncManagerTableStack: Stack;
139+
readonly icav2DataCopyTableStack: Stack;
134140

135141
constructor(
136142
scope: Construct,
@@ -307,6 +313,14 @@ export class StatefulStackCollection {
307313
...statefulConfiguration.fastqSyncManagerTableStackProps,
308314
}
309315
);
316+
this.icav2DataCopyTableStack = new Icav2DataCopyManagerTable(
317+
scope,
318+
'Icav2DataCopyManagerTableStack',
319+
{
320+
...this.createTemplateProps(env, 'Icav2DataCopyManagerTableStack'),
321+
...statefulConfiguration.icav2DataCopyTableStackProps,
322+
}
323+
);
310324
}
311325

312326
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# ICAv2 Data Copy Manager
2+
3+
Service for copying data from one location to another.
4+
5+
Supports a TaskToken object that can be used to allow processes to hang until the copy is complete for other services
6+
that may call this service.
7+
8+
## Usage
9+
10+
Given a list of source uris, and a destination uri, the service will copy the data from the source to the destination.
11+
12+
The destination uri does not need to exist prior to the copy, but the source uris must exist.
13+
14+
If the source uri is a folder, it will be a subfolder in the destination.
15+
16+
If a file size is under 8 Mb, we will use the `requests` library to download the file and upload it to the destination,
17+
since single-part uploads often fail when the source object is tagged.
18+
19+
AWS S3 URIs in the sourceUriList and destinationUri are also supported.
20+
21+
The Task Token is optional and can be used to allow the calling service to wait for the copy to complete.
22+
23+
## Event Example
24+
25+
```json
26+
{
27+
"EventBusName": "OrcaBusMain",
28+
"Source": "Whatever",
29+
"DetailType": "ICAv2DataCopySync",
30+
"Detail": {
31+
"payload": {
32+
"sourceUriList": [
33+
"icav2://project-id-or-name/path-to-data.txt",
34+
"icav2://project-id-or-name/path-to-folder/"
35+
],
36+
"destinationUri": "icav2://project-id-or-name/path-to-destination/"
37+
},
38+
"taskToken": "your-task-token"
39+
}
40+
}
41+
```

0 commit comments

Comments
 (0)