@orcabus/platform-cdk-constructs 0.0.16 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.jsii CHANGED
@@ -6394,6 +6394,6 @@
6394
6394
  "symbolId": "shared-config/networking:OrcaBusVpc"
6395
6395
  }
6396
6396
  },
6397
- "version": "0.0.16",
6398
- "fingerprint": "ZBITxrxi0lyTyNseWHRgqHQf3s2YzmMyq7WVZ1YE0js="
6397
+ "version": "0.0.17",
6398
+ "fingerprint": "JOiC6iKaNG6BMY7XsewmVTAEHSHX+qV3ybXaUWTW6s4="
6399
6399
  }
@@ -15,7 +15,7 @@ const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
15
15
  const aws_route53_targets_1 = require("aws-cdk-lib/aws-route53-targets");
16
16
  const config_1 = require("./config");
17
17
  class OrcaBusApiGateway extends constructs_1.Construct {
18
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.apigateway.OrcaBusApiGateway", version: "0.0.16" };
18
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.apigateway.OrcaBusApiGateway", version: "0.0.17" };
19
19
  /**
20
20
  * The AWS region where the API Gateway is deployed.
21
21
  */
@@ -13,7 +13,7 @@ exports.CROSS_DEPLOYMENT_ARTIFACT_BUCKET_NAME = "orcabus-cross-deployment-codepi
13
13
  exports.CROSS_DEPLOYMENT_ARTIFACT_KMS_ALIAS = "orcabus-cross-deployment-codepipeline-artifact";
14
14
  exports.CROSS_DEPLOYMENT_ARTIFACT_KMS_ARN_SSM_PARAMETER_NAME = "/orcabus/deployment-stack-pipeline/artifact-bucket/kms-key-arn";
15
15
  class CrossDeploymentArtifactBucket extends constructs_1.Construct {
16
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.CrossDeploymentArtifactBucket", version: "0.0.16" };
16
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.CrossDeploymentArtifactBucket", version: "0.0.17" };
17
17
  /**
18
18
  * The S3 bucket used to store artifacts for cross-deployment pipelines.
19
19
  */
@@ -31,7 +31,7 @@ exports.DEFAULT_SYNTH_STEP_PARTIAL_BUILD_SPEC = {
31
31
  * before using this construct.
32
32
  */
33
33
  class DeploymentStackPipeline extends constructs_1.Construct {
34
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.DeploymentStackPipeline", version: "0.0.16" };
34
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.DeploymentStackPipeline", version: "0.0.17" };
35
35
  /**
36
36
  * The code pipeline construct that is created.
37
37
  */
package/dynamodb/index.js CHANGED
@@ -40,7 +40,7 @@ const dynamodb = __importStar(require("aws-cdk-lib/aws-dynamodb"));
40
40
  const aws_cdk_lib_1 = require("aws-cdk-lib");
41
41
  const config_1 = require("./config");
42
42
  class DynamoDbPartitionedConstruct extends constructs_1.Construct {
43
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.dynamodb.DynamoDbPartitionedConstruct", version: "0.0.16" };
43
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.dynamodb.DynamoDbPartitionedConstruct", version: "0.0.17" };
44
44
  table;
45
45
  constructor(scope, id, props) {
46
46
  super(scope, id);
@@ -75,7 +75,7 @@ class DynamoDbPartitionedConstruct extends constructs_1.Construct {
75
75
  }
76
76
  exports.DynamoDbPartitionedConstruct = DynamoDbPartitionedConstruct;
77
77
  class DynamoDbNonPartitionedConstruct extends constructs_1.Construct {
78
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.dynamodb.DynamoDbNonPartitionedConstruct", version: "0.0.16" };
78
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.dynamodb.DynamoDbNonPartitionedConstruct", version: "0.0.17" };
79
79
  table;
80
80
  constructor(scope, id, props) {
81
81
  super(scope, id);
package/ecs/index.js CHANGED
@@ -52,7 +52,7 @@ exports.LAMBDA_ARCHITECTURE_MAP = {
52
52
  ['ARM64']: lambda.Architecture.ARM_64
53
53
  };
54
54
  class EcsFargateTaskConstruct extends constructs_1.Construct {
55
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.ecs.EcsFargateTaskConstruct", version: "0.0.16" };
55
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.ecs.EcsFargateTaskConstruct", version: "0.0.17" };
56
56
  cluster;
57
57
  taskDefinition;
58
58
  securityGroup;
package/lambda/index.js CHANGED
@@ -56,7 +56,7 @@ function getPythonUvDockerImage() {
56
56
  return aws_cdk_lib_1.DockerImage.fromBuild(path_1.default.join(__dirname, 'build_python'));
57
57
  }
58
58
  class PythonUvFunction extends aws_lambda_python_alpha_1.PythonFunction {
59
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.lambda.PythonUvFunction", version: "0.0.16" };
59
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.lambda.PythonUvFunction", version: "0.0.17" };
60
60
  // Class constructs, to be used for caching the layers
61
61
  // This means that if there are multiple lambdas throughout the stack
62
62
  // They will all use the same layer
@@ -109,20 +109,14 @@ def add_read_set(fastq_id: str, read_set: ReadSet) -> FastqListRow:
109
109
  )
110
110
 
111
111
 
112
- def detach_read_set(fastq_id: str, read_set: ReadSet) -> FastqListRow:
112
+ def detach_read_set(fastq_id: str) -> FastqListRow:
113
113
  """
114
114
  Detach a read set to a fastq id.
115
115
 
116
116
  :param fastq_id: Fastq str
117
- :param read_set: ReadSet str
118
117
  """
119
- for key in read_set.keys():
120
- if key not in ReadSet.__annotations__:
121
- raise ValueError(f"Invalid parameter: {key}")
122
-
123
118
  return fastq_patch_request(
124
- f"{FASTQ_LIST_ROW_ENDPOINT}/{fastq_id}/detachFastqPairStorageObject",
125
- params=dict(read_set)
119
+ f"{FASTQ_LIST_ROW_ENDPOINT}/{fastq_id}/detachFastqPairStorageObject"
126
120
  )
127
121
 
128
122
 
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env python3
2
+ from typing import Optional, Dict
3
+
4
+ from orcabus_api_tools.utils.requests_helpers import get_url, get_request_response_results, get_request
5
+ from orcabus_api_tools.workflow.globals import WORKFLOW_SUBDOMAIN_NAME
6
+
7
+
8
+ def get_workflow_url(endpoint: str) -> str:
9
+ """
10
+ Get the URL for the Metadata endpoint
11
+ :param endpoint:
12
+ :return:
13
+ """
14
+ return get_url(
15
+ endpoint,
16
+ WORKFLOW_SUBDOMAIN_NAME
17
+ )
18
+
19
+
20
+ def get_workflow_request(
21
+ endpoint: str,
22
+ params: Optional[Dict] = None,
23
+ ):
24
+ return get_request(get_workflow_url(endpoint), params=params)
25
+
26
+
27
+ def get_workflow_request_response_results(
28
+ endpoint: str,
29
+ params: Optional[Dict] = None,
30
+ ):
31
+ return get_request_response_results(get_workflow_url(endpoint), params=params)
32
+
33
+
34
+ # Now 'import all'
35
+ from .create_helpers import (
36
+ create_portal_run_id,
37
+ create_workflow_run_name_from_workflow_name_workflow_version_and_portal_run_id,
38
+ )
39
+
40
+ from .metadata_helpers import (
41
+ get_workflows_from_library_id
42
+ )
43
+
44
+ from .payload_helpers import (
45
+ get_payload,
46
+ get_payload_from_state,
47
+ get_latest_payload_from_workflow_run,
48
+ get_latest_payload_from_portal_run_id,
49
+ )
50
+
51
+ from .workflow_run_helpers import (
52
+ get_workflow_run,
53
+ get_workflow_run_from_portal_run_id,
54
+ get_workflow_run_state,
55
+ )
56
+
57
+
58
+ __all__ = [
59
+ # Create
60
+ "create_portal_run_id",
61
+ "create_workflow_run_name_from_workflow_name_workflow_version_and_portal_run_id",
62
+ # Metadata
63
+ "get_workflows_from_library_id",
64
+ # Payload
65
+ "get_payload",
66
+ "get_payload_from_state",
67
+ "get_latest_payload_from_workflow_run",
68
+ "get_latest_payload_from_portal_run_id",
69
+ # Workflow Run
70
+ "get_workflow_run",
71
+ "get_workflow_run_from_portal_run_id",
72
+ "get_workflow_run_state",
73
+ ]
@@ -0,0 +1,30 @@
1
+ from datetime import datetime, timezone
2
+ import random
3
+
4
+ from orcabus_api_tools.workflow.globals import WORKFLOW_RUN_PREFIX
5
+
6
+
7
+ def generate_rand_hex_string(length: int = 8) -> str:
8
+ """
9
+ Generate a random hexadecimal string of a given length.
10
+ :param length: Length of the hexadecimal string to generate.
11
+ :return: Random hexadecimal string.
12
+ """
13
+ return ''.join(random.choices('0123456789abcdef', k=length))
14
+
15
+
16
+ def create_portal_run_id():
17
+ return datetime.now(timezone.utc).strftime("%Y%m%d") + str(generate_rand_hex_string())[0:8]
18
+
19
+
20
+ def create_workflow_run_name_from_workflow_name_workflow_version_and_portal_run_id(
21
+ workflow_name: str,
22
+ workflow_version: str,
23
+ portal_run_id: str
24
+ ):
25
+ return '--'.join([
26
+ WORKFLOW_RUN_PREFIX,
27
+ workflow_name.lower(),
28
+ workflow_version.replace(".", "-"),
29
+ portal_run_id
30
+ ])
@@ -0,0 +1,7 @@
1
+ # Run name for sequence run manager
2
+ WORKFLOW_SUBDOMAIN_NAME = 'workflow'
3
+
4
+ WORKFLOW_RUN_ENDPOINT = 'api/v1/workflowrun'
5
+ PAYLOAD_ENDPOINT = 'api/v1/payload'
6
+
7
+ WORKFLOW_RUN_PREFIX = 'umccr--automated'
@@ -7,9 +7,8 @@ Get workflows from library id
7
7
  # Standard imports
8
8
  from typing import List
9
9
 
10
-
11
10
  # Local imports
12
- from .requests_helpers import get_request_response_results
11
+ from . import get_workflow_request_response_results
13
12
  from .globals import WORKFLOW_RUN_ENDPOINT
14
13
  from .models import WorkflowRunDetail
15
14
 
@@ -20,7 +19,7 @@ def get_workflows_from_library_id(library_id: str) -> List[WorkflowRunDetail]:
20
19
  :param library_id:
21
20
  :return:
22
21
  """
23
- return get_request_response_results(
22
+ return get_workflow_request_response_results(
24
23
  WORKFLOW_RUN_ENDPOINT,
25
24
  params={
26
25
  "libraries__libraryId": library_id
@@ -7,9 +7,9 @@ Getting the payload helpers
7
7
  # Standard imports
8
8
  from typing import Dict
9
9
 
10
+ from . import get_workflow_request
10
11
  # Local imports
11
12
  from .globals import PAYLOAD_ENDPOINT
12
- from .requests_helpers import get_request_results
13
13
  from .models import Payload
14
14
 
15
15
 
@@ -20,7 +20,7 @@ def get_payload(payload_id: str) -> Dict:
20
20
  :return:
21
21
  """
22
22
  # Get subject
23
- return get_request_results(PAYLOAD_ENDPOINT, payload_id)
23
+ return get_workflow_request(f"{PAYLOAD_ENDPOINT}/{payload_id}")
24
24
 
25
25
 
26
26
  def get_payload_from_state(workflow_run_orcabus_id: str, status: str):
@@ -51,7 +51,7 @@ def get_latest_payload_from_workflow_run(workflow_run_orcabus_id: str) -> Payloa
51
51
  workflow_run = get_workflow_run(workflow_run_orcabus_id)
52
52
 
53
53
  # Get the payload
54
- return get_payload_from_state(workflow_run_orcabus_id, workflow_run['currentState']['orcabusId'])
54
+ return Payload(**get_payload_from_state(workflow_run_orcabus_id, workflow_run['currentState']['orcabusId']))
55
55
 
56
56
 
57
57
  def get_latest_payload_from_portal_run_id(portal_run_id: str) -> Payload:
@@ -61,4 +61,4 @@ def get_latest_payload_from_portal_run_id(portal_run_id: str) -> Payload:
61
61
  workflow_run = get_workflow_run_from_portal_run_id(portal_run_id)
62
62
 
63
63
  # Get the payload
64
- return get_payload_from_state(workflow_run['orcabusId'], workflow_run['currentState']['orcabusId'])
64
+ return Payload(**get_payload_from_state(workflow_run['orcabusId'], workflow_run['currentState']['orcabusId']))
@@ -5,14 +5,12 @@ Helpers for using the contact API endpoint
5
5
  """
6
6
 
7
7
  # Standard imports
8
- from typing import Dict
9
8
  from requests import HTTPError
9
+ from . import get_workflow_request_response_results, get_workflow_request
10
10
 
11
11
  # Local imports
12
12
  from .globals import WORKFLOW_RUN_ENDPOINT
13
- from .requests_helpers import get_request_response_results, get_request_results_ext, get_request_results
14
13
  from .models import WorkflowRun, State
15
- from .. import WorkflowRunNotFoundError
16
14
 
17
15
 
18
16
  def get_workflow_run(workflow_run_orcabus_id: str) -> WorkflowRun:
@@ -23,7 +21,7 @@ def get_workflow_run(workflow_run_orcabus_id: str) -> WorkflowRun:
23
21
  """
24
22
  # Get workflow run
25
23
  try:
26
- return get_request_results(WORKFLOW_RUN_ENDPOINT, workflow_run_orcabus_id)
24
+ return get_workflow_request(f"{WORKFLOW_RUN_ENDPOINT}/{workflow_run_orcabus_id}")
27
25
  except HTTPError as e:
28
26
  from .errors import WorkflowRunNotFoundError
29
27
  raise WorkflowRunNotFoundError(workflow_run_id=workflow_run_orcabus_id) from e
@@ -42,13 +40,13 @@ def get_workflow_run_from_portal_run_id(portal_run_id: str) -> WorkflowRun:
42
40
  "portalRunId": portal_run_id
43
41
  }
44
42
 
45
- workflow_runs_list = get_request_response_results(WORKFLOW_RUN_ENDPOINT, params)
43
+ workflow_runs_list = get_workflow_request_response_results(WORKFLOW_RUN_ENDPOINT, params)
46
44
 
47
45
  if len(workflow_runs_list) == 0:
48
46
  raise WorkflowRunNotFoundError(portal_run_id=portal_run_id)
49
47
 
50
48
  try:
51
- return get_request_results(
49
+ return get_workflow_request_response_results(
52
50
  WORKFLOW_RUN_ENDPOINT,
53
51
  workflow_runs_list[0]["orcabusId"],
54
52
  )
@@ -68,7 +66,7 @@ def get_workflow_run_state(workflow_run_orcabus_id: str, status: str) -> State:
68
66
  return next(
69
67
  filter(
70
68
  lambda workflow_state_iter_: workflow_state_iter_["status"] == status,
71
- get_request_results_ext(WORKFLOW_RUN_ENDPOINT, workflow_run_orcabus_id, "state")
69
+ get_workflow_request_response_results(f"{WORKFLOW_RUN_ENDPOINT}/{workflow_run_orcabus_id}/{status}")
72
70
  )
73
71
  )
74
72
  except HTTPError as e:
@@ -7,7 +7,7 @@ const aws_iam_1 = require("aws-cdk-lib/aws-iam");
7
7
  * A construct which represents a named role that a Lambda function can assume.
8
8
  */
9
9
  class NamedLambdaRole extends aws_iam_1.Role {
10
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.namedLambdaRole.NamedLambdaRole", version: "0.0.16" };
10
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.namedLambdaRole.NamedLambdaRole", version: "0.0.17" };
11
11
  constructor(scope, id, props) {
12
12
  super(scope, id, {
13
13
  assumedBy: new aws_iam_1.ServicePrincipal("lambda.amazonaws.com"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orcabus/platform-cdk-constructs",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "CDK Package for OrcaBus infrastructure.",
5
5
  "main": "index.ts",
6
6
  "types": "index.d.ts",
@@ -15,7 +15,7 @@ const aws_cdk_lib_1 = require("aws-cdk-lib");
15
15
  * to the provider framework.
16
16
  */
17
17
  class ProviderFunction extends constructs_1.Construct {
18
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.provider.ProviderFunction", version: "0.0.16" };
18
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.provider.ProviderFunction", version: "0.0.17" };
19
19
  _function;
20
20
  _response;
21
21
  constructor(scope, id, props) {
@@ -23,7 +23,7 @@ exports.VPC_LOOKUP_PROPS = {
23
23
  * Helper for looking up the shared OrcaBus VPC.
24
24
  */
25
25
  class OrcaBusVpc {
26
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.networking.OrcaBusVpc", version: "0.0.16" };
26
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.networking.OrcaBusVpc", version: "0.0.17" };
27
27
  /**
28
28
  * The shared VPC that is used by OrcaBus.
29
29
  * @param scope
@@ -42,7 +42,7 @@ exports.SHARED_SECURITY_GROUP_NAME = "OrcaBusSharedComputeSecurityGroup";
42
42
  * Helper for looking up the shared compute security group by name.
43
43
  */
44
44
  class OrcaBusSharedComputeSecurityGroup {
45
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.networking.OrcaBusSharedComputeSecurityGroup", version: "0.0.16" };
45
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.networking.OrcaBusSharedComputeSecurityGroup", version: "0.0.17" };
46
46
  /**
47
47
  * The shared security group that is used by compute resources to access the database.
48
48
  * @param scope