@orcabus/platform-cdk-constructs 0.0.37 → 0.0.39

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.
Files changed (37) hide show
  1. package/.jsii +2 -2
  2. package/api-gateway/api-gateway.js +1 -1
  3. package/deployment-stack-pipeline/artifact-bucket.js +1 -1
  4. package/deployment-stack-pipeline/pipeline.js +1 -1
  5. package/dynamodb/index.js +2 -2
  6. package/ecs/index.js +1 -1
  7. package/lambda/index.js +1 -1
  8. package/lambda/layers/mart_tools/src/mart_tools/mart/models.py +0 -2
  9. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/data_sharing/__init__.py +4 -4
  10. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/data_sharing/globals.py +0 -1
  11. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/data_sharing/models.py +6 -2
  12. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/data_sharing/update_helpers.py +14 -18
  13. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq/__init__.py +9 -4
  14. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq/create_helpers.py +2 -2
  15. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq/globals.py +1 -0
  16. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq/models.py +0 -1
  17. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq/query_helpers.py +21 -3
  18. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq/update_helpers.py +6 -6
  19. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq_decompression/globals.py +0 -1
  20. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq_decompression/update_helpers.py +1 -1
  21. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/filemanager/file_helpers.py +11 -17
  22. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/icav2_wes/__init__.py +5 -5
  23. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/icav2_wes/create_helpers.py +5 -5
  24. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/icav2_wes/models.py +6 -1
  25. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/icav2_wes/update_helpers.py +12 -9
  26. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/mart/models.py +0 -2
  27. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/metadata/project_helpers.py +1 -1
  28. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/metadata/sample_helpers.py +2 -2
  29. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/metadata/subject_helpers.py +4 -4
  30. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/sequence/models.py +1 -1
  31. package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/utils/requests_helpers.py +0 -2
  32. package/monitored-queue/index.js +1 -1
  33. package/named-lambda-role/index.js +1 -1
  34. package/package.json +1 -1
  35. package/provider-function/index.js +1 -1
  36. package/shared-config/networking.js +2 -2
  37. package/shared-config/slack.js +1 -1
package/.jsii CHANGED
@@ -6756,6 +6756,6 @@
6756
6756
  "symbolId": "shared-config/slack:SlackAlerts"
6757
6757
  }
6758
6758
  },
6759
- "version": "0.0.37",
6760
- "fingerprint": "WJnxu31JCGx88czmTm4wEcOiYLDLTbs658r/FyyoErY="
6759
+ "version": "0.0.39",
6760
+ "fingerprint": "qjgprLux9UbUIiorobtrlx7b3YD70Zoe6UAFDPpxrKg="
6761
6761
  }
@@ -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.37" };
18
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.apigateway.OrcaBusApiGateway", version: "0.0.39" };
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.37" };
16
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.CrossDeploymentArtifactBucket", version: "0.0.39" };
17
17
  /**
18
18
  * The S3 bucket used to store artifacts for cross-deployment pipelines.
19
19
  */
@@ -32,7 +32,7 @@ exports.DEFAULT_SYNTH_STEP_PARTIAL_BUILD_SPEC = {
32
32
  * before using this construct.
33
33
  */
34
34
  class DeploymentStackPipeline extends constructs_1.Construct {
35
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.DeploymentStackPipeline", version: "0.0.37" };
35
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.DeploymentStackPipeline", version: "0.0.39" };
36
36
  /**
37
37
  * The code pipeline construct that is created.
38
38
  */
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.37" };
43
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.dynamodb.DynamoDbPartitionedConstruct", version: "0.0.39" };
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.37" };
78
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.dynamodb.DynamoDbNonPartitionedConstruct", version: "0.0.39" };
79
79
  table;
80
80
  constructor(scope, id, props) {
81
81
  super(scope, id);
package/ecs/index.js CHANGED
@@ -55,7 +55,7 @@ exports.LAMBDA_ARCHITECTURE_MAP = {
55
55
  ['ARM64']: lambda.Architecture.ARM_64
56
56
  };
57
57
  class EcsFargateTaskConstruct extends constructs_1.Construct {
58
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.ecs.EcsFargateTaskConstruct", version: "0.0.37" };
58
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.ecs.EcsFargateTaskConstruct", version: "0.0.39" };
59
59
  cluster;
60
60
  taskDefinition;
61
61
  taskExecutionRole;
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.37" };
59
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.lambda.PythonUvFunction", version: "0.0.39" };
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
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
 
3
3
  from enum import Enum
4
- from typing import Literal
5
-
6
4
 
7
5
  class AthenaDMLTypes(Enum):
8
6
  # https://docs.aws.amazon.com/athena/latest/ug/data-types.html
@@ -41,21 +41,21 @@ def get_data_sharing_request_response_results(
41
41
 
42
42
  def data_sharing_patch_request(
43
43
  endpoint: str,
44
- params: Optional[Dict] = None,
44
+ json_data: Optional[Dict] = None,
45
45
  ):
46
46
  return patch_request(
47
47
  url=get_data_sharing_url(endpoint),
48
- params=params
48
+ json_data=json_data
49
49
  )
50
50
 
51
51
 
52
52
  def data_sharing_post_request(
53
53
  endpoint: str,
54
- params: Optional[Dict] = None,
54
+ json_data: Optional[Dict] = None,
55
55
  ):
56
56
  return patch_request(
57
57
  url=get_data_sharing_url(endpoint),
58
- params=params
58
+ json_data=json_data
59
59
  )
60
60
 
61
61
 
@@ -1,6 +1,5 @@
1
1
  # Imports
2
2
  import re
3
- from typing import Literal
4
3
 
5
4
  # AWS PARAMETERS
6
5
  DATA_SHARING_SUBDOMAIN_NAME = "data-sharing"
@@ -1,4 +1,4 @@
1
- from typing import Literal, TypedDict, NotRequired
1
+ from typing import Literal, TypedDict, NotRequired, Union
2
2
 
3
3
  PackageStatusType = Literal[
4
4
  "PENDING",
@@ -17,7 +17,6 @@ PushJobStatusType = Literal[
17
17
  ]
18
18
 
19
19
 
20
-
21
20
  class PackageObject(TypedDict):
22
21
  id: str
23
22
  packageName: str
@@ -26,3 +25,8 @@ class PackageObject(TypedDict):
26
25
  requestTime: str
27
26
  completionTime: NotRequired[str]
28
27
  hasExpired: NotRequired[bool]
28
+
29
+
30
+ class JobPatchParameters(TypedDict):
31
+ status: Union[PackageStatusType, PushJobStatusType]
32
+ errorMessage: NotRequired[str]
@@ -1,38 +1,37 @@
1
- from typing import Optional
1
+ from typing import Unpack
2
2
 
3
3
  from . import data_sharing_patch_request
4
4
  from .globals import PACKAGE_ENDPOINT, PUSH_ENDPOINT
5
- from .models import PackageStatusType, PackageObject, PushJobStatusType
5
+ from .models import PackageObject, JobPatchParameters
6
6
 
7
7
 
8
8
  def update_package_status(
9
9
  package_id: str,
10
- package_status: PackageStatusType,
11
- error_message: Optional[str] = None
10
+ **kwargs: Unpack[JobPatchParameters]
12
11
  ) -> PackageObject:
13
12
  """
14
13
  Add QC stats to a fastq_id.
15
14
 
16
15
  :param package_id: The package id
17
- :param package_status: The package status to set
18
- :param error_message: Optional error message
16
+ :param kwargs: JobPatchParameters to update the package with.
19
17
  """
18
+ # Raise error if any of the kwargs are not in the FastqListRowQueryParameters
19
+ for key in kwargs.keys():
20
+ if key not in JobPatchParameters.__annotations__:
21
+ raise ValueError(f"Invalid parameter: {key}")
22
+
20
23
  return data_sharing_patch_request(
21
24
  f"{PACKAGE_ENDPOINT}/{package_id}",
22
- params=dict(filter(
25
+ json_data=dict(filter(
23
26
  lambda x: x[1] is not None,
24
- {
25
- "status": package_status,
26
- "error_message": error_message
27
- }.items()
27
+ kwargs.items()
28
28
  ))
29
29
  )
30
30
 
31
31
 
32
32
  def update_push_job_status(
33
33
  push_job_id: str,
34
- push_job_status: PushJobStatusType,
35
- error_message: Optional[str] = None
34
+ **kwargs: Unpack[JobPatchParameters]
36
35
  ) -> PackageObject:
37
36
  """
38
37
  Add push job status to a push job.
@@ -43,11 +42,8 @@ def update_push_job_status(
43
42
  """
44
43
  return data_sharing_patch_request(
45
44
  f"{PUSH_ENDPOINT}/{push_job_id}",
46
- params=dict(filter(
45
+ json_data=dict(filter(
47
46
  lambda x: x[1] is not None,
48
- {
49
- "status": push_job_status,
50
- "error_message": error_message
51
- }.items()
47
+ kwargs.items()
52
48
  ))
53
49
  )
@@ -40,27 +40,31 @@ def get_fastq_request_response_results(
40
40
  ):
41
41
  return get_request_response_results(
42
42
  url=get_fastq_url(endpoint),
43
- params=params
43
+ params=params,
44
44
  )
45
45
 
46
46
 
47
47
  def fastq_patch_request(
48
48
  endpoint: str,
49
49
  params: Optional[Dict] = None,
50
+ json_data: Optional[Dict] = None,
50
51
  ):
51
52
  return patch_request(
52
53
  url=get_fastq_url(endpoint),
53
- params=params
54
+ params=params,
55
+ json_data=json_data,
54
56
  )
55
57
 
56
58
 
57
59
  def fastq_post_request(
58
60
  endpoint: str,
59
61
  params: Optional[Dict] = None,
62
+ json_data: Optional[Dict] = None,
60
63
  ):
61
64
  return post_request(
62
65
  url=get_fastq_url(endpoint),
63
- params=params
66
+ params=params,
67
+ json_data=json_data,
64
68
  )
65
69
 
66
70
 
@@ -100,7 +104,7 @@ from .query_helpers import (
100
104
  get_fastqs_in_project,
101
105
  get_fastq_list_rows_in_fastq_set,
102
106
  get_fastqs_in_fastq_set,
103
- get_fastq_jobs,
107
+ get_fastq_jobs, get_fastq_by_rgid,
104
108
  )
105
109
 
106
110
  # Updaters
@@ -161,6 +165,7 @@ __all__ = [
161
165
  "get_fastqs_in_subject",
162
166
  "get_fastqs_in_individual",
163
167
  "get_fastqs_in_project",
168
+ "get_fastq_by_rgid",
164
169
  "get_fastq_list_rows_in_fastq_set",
165
170
  "get_fastqs_in_fastq_set",
166
171
  "get_fastq_jobs",
@@ -41,7 +41,7 @@ def create_fastq_object(**kwargs: Unpack[FastqCreate]) -> Fastq:
41
41
  return Fastq(
42
42
  **fastq_post_request(
43
43
  endpoint=FASTQ_ENDPOINT,
44
- params=dict(kwargs)
44
+ json_data=dict(kwargs)
45
45
  )
46
46
  )
47
47
 
@@ -59,6 +59,6 @@ def create_fastq_set_object(**kwargs: Unpack[FastqSetCreate]) -> FastqSet:
59
59
  return FastqSet(
60
60
  **fastq_post_request(
61
61
  endpoint=FASTQ_SET_ENDPOINT,
62
- params=dict(kwargs)
62
+ json_data=dict(kwargs)
63
63
  )
64
64
  )
@@ -8,6 +8,7 @@ FASTQ_SUBDOMAIN_NAME = "fastq"
8
8
  # API ENDPOINTS
9
9
  FASTQ_ENDPOINT = "api/v1/fastq"
10
10
  FASTQ_SET_ENDPOINT = "api/v1/fastqSet"
11
+ RGID_ENDPOINT = "api/v1/rgid"
11
12
 
12
13
  # REGEX
13
14
  ORCABUS_ULID_REGEX_MATCH = re.compile(r'^[a-z0-9]{3}\.[A-Z0-9]{26}$')
@@ -35,7 +35,6 @@
35
35
  }
36
36
  """
37
37
 
38
- from enum import Enum
39
38
  from typing import (
40
39
  TypedDict,
41
40
  Optional,
@@ -15,7 +15,7 @@ get_fastqs_in_individual
15
15
 
16
16
  get_fastqs_in_project
17
17
 
18
- get_fastq_by_rgid_and_instrument_run_id
18
+ get_fastq_by_rgid
19
19
 
20
20
  """
21
21
  from functools import reduce
@@ -25,7 +25,7 @@ from typing import List, Unpack
25
25
  from fastapi.encoders import jsonable_encoder
26
26
 
27
27
  from . import get_fastq_request_response_results, get_fastq_request
28
- from .globals import FASTQ_ENDPOINT, FASTQ_SET_ENDPOINT
28
+ from .globals import FASTQ_ENDPOINT, FASTQ_SET_ENDPOINT, RGID_ENDPOINT
29
29
  from .models import (
30
30
  FastqSet, Job, FastqParameters, FastqSetQueryParameters,
31
31
  FastqGetResponseParameters, VALID_BATCH_KEYS, Fastq
@@ -58,7 +58,7 @@ def get_fastq_set(
58
58
  """
59
59
  # Raise error if any of the kwargs are not in the FastqSetQueryParameters
60
60
  for key in kwargs.keys():
61
- if key not in FastqSetQueryParameters.__annotations__:
61
+ if key not in FastqGetResponseParameters.__annotations__:
62
62
  raise ValueError(f"Invalid parameter: {key}")
63
63
 
64
64
  return FastqSet(
@@ -230,6 +230,24 @@ def get_fastqs_in_project(project_id):
230
230
  )
231
231
 
232
232
 
233
+ def get_fastq_by_rgid(
234
+ rgid: str,
235
+ **kwargs: Unpack[FastqGetResponseParameters]
236
+ ) -> Fastq:
237
+ # Raise error if any of the kwargs are not in the FastqGetResponseParameters
238
+ for key in kwargs.keys():
239
+ if key not in FastqGetResponseParameters.__annotations__:
240
+ raise ValueError(f"Invalid parameter: {key}")
241
+
242
+ return get_fastq_request(
243
+ f"{RGID_ENDPOINT}/{rgid}",
244
+ params=dict(filter(
245
+ lambda kv_iter_: kv_iter_[1] is not None,
246
+ kwargs.items()
247
+ ))
248
+ )
249
+
250
+
233
251
  def get_fastq_list_rows_in_fastq_set(fastq_set_id):
234
252
  """
235
253
  DEPRECATED: Use get_fastqs_in_fastq_set instead
@@ -37,7 +37,7 @@ def add_qc_stats(fastq_id: str, qc_stats: QcStats) -> Fastq:
37
37
 
38
38
  return fastq_patch_request(
39
39
  f"{FASTQ_ENDPOINT}/{fastq_id}/addQcStats",
40
- params=dict(qc_stats)
40
+ json_data=dict(qc_stats)
41
41
  )
42
42
 
43
43
 
@@ -54,7 +54,7 @@ def add_read_count(fastq_id: str, read_count: ReadCount) -> Fastq:
54
54
 
55
55
  return fastq_patch_request(
56
56
  f"{FASTQ_ENDPOINT}/{fastq_id}/addReadCount",
57
- params=dict(read_count)
57
+ json_data=dict(read_count)
58
58
  )
59
59
 
60
60
 
@@ -71,7 +71,7 @@ def add_file_compression_information(fastq_id: str, file_compression_information
71
71
 
72
72
  return fastq_patch_request(
73
73
  f"{FASTQ_ENDPOINT}/{fastq_id}/addFileCompressionInformation",
74
- params=dict(file_compression_information)
74
+ json_data=dict(file_compression_information)
75
75
  )
76
76
 
77
77
 
@@ -88,7 +88,7 @@ def add_ntsm_storage_object(fastq_id: str, ntsm_fastq_storage_object: FileStorag
88
88
 
89
89
  return fastq_patch_request(
90
90
  f"{FASTQ_ENDPOINT}/{fastq_id}/addNtsmStorageObject",
91
- params=dict(ntsm_fastq_storage_object)
91
+ json_data=dict(ntsm_fastq_storage_object)
92
92
  )
93
93
 
94
94
 
@@ -105,7 +105,7 @@ def add_read_set(fastq_id: str, read_set: ReadSet) -> Fastq:
105
105
 
106
106
  return fastq_patch_request(
107
107
  f"{FASTQ_ENDPOINT}/{fastq_id}/addFastqPairStorageObject",
108
- params=dict(read_set)
108
+ json_data=dict(read_set)
109
109
  )
110
110
 
111
111
 
@@ -144,7 +144,7 @@ def invalidate_fastq(fastq_id: str) -> Fastq:
144
144
 
145
145
  def link_fastq_list_row_to_fastq_set(fastq_id: str, fastq_set_id: str) -> FastqSet:
146
146
  """
147
- Deprecated: Use `link_fastq_to_fast_set` instead.
147
+ Deprecated: Use `link_fastq_to_fastq_set` instead.
148
148
  Link a fastq id to a fastq set.
149
149
 
150
150
  :param fastq_id:
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
3
  import re
4
- from enum import Enum
5
4
 
6
5
  # AWS PARAMETERS
7
6
  FASTQ_DECOMPRESSION_SUBDOMAIN_NAME = "fastq-decompression"
@@ -5,7 +5,7 @@ Update helpers for the update script.
5
5
  """
6
6
 
7
7
  # Standard imports
8
- from typing import Optional, Dict, Any, Unpack
8
+ from typing import Unpack
9
9
 
10
10
  # Local imports
11
11
  from . import fastq_decompression_patch_request
@@ -23,7 +23,7 @@ from . import (
23
23
  from .globals import (
24
24
  S3_LIST_ENDPOINT,
25
25
  S3_BUCKETS_BY_ACCOUNT_ID,
26
- S3_PREFIXES_BY_ACCOUNT_ID
26
+ S3_PREFIXES_BY_ACCOUNT_ID, S3_ATTRIBUTES_LIST_ENDPOINT
27
27
  )
28
28
 
29
29
  if typing.TYPE_CHECKING:
@@ -108,27 +108,22 @@ def get_file_object_from_ingest_id(ingest_id: str, **kwargs) -> FileObject:
108
108
 
109
109
  def list_files_from_portal_run_id(
110
110
  portal_run_id: str,
111
- workflow_name: str,
112
- **kwargs
111
+ remove_log_files: bool = True,
113
112
  ) -> List[FileObject]:
114
- portal_run_id_date_str = datetime.strptime(portal_run_id[:8], "%Y%m%d")
115
113
 
116
114
  # Get files from cache
117
- cache_response = get_file_manager_request_response_results(S3_LIST_ENDPOINT, {
118
- "bucket": get_cache_bucket_from_account_id(),
119
- "key": f"{get_analysis_cache_prefix_from_account_id()}/{workflow_name}/{portal_run_id}/*",
120
- **kwargs
115
+ all_files_list = get_file_manager_request_response_results(S3_ATTRIBUTES_LIST_ENDPOINT, {
116
+ "portalRunId": portal_run_id,
117
+ "currentState": json.dumps(True)
121
118
  })
122
119
 
123
- # Get files from archive
124
- archive_response = get_file_manager_request_response_results(S3_LIST_ENDPOINT, {
125
- "bucket": get_archive_analysis_bucket_from_account_id(),
126
- "key": f"v1/year={portal_run_id_date_str.year}/month={str(portal_run_id_date_str.month).zfill(2)}/{portal_run_id}/*",
127
- **kwargs
128
- })
120
+ if not remove_log_files:
121
+ return all_files_list
129
122
 
130
- # Return as a list of FileObject models
131
- return [FileObject(**file) for file in cache_response + archive_response]
123
+ return list(filter(
124
+ lambda file_iter_: not '/ica_logs/' in file_iter_['key'],
125
+ all_files_list
126
+ ))
132
127
 
133
128
 
134
129
  def get_presigned_url(s3_object_id: str) -> str:
@@ -137,7 +132,6 @@ def get_presigned_url(s3_object_id: str) -> str:
137
132
  :param s3_object_id:
138
133
  :return:
139
134
  """
140
-
141
135
  response = get_file_manager_request(f"{S3_LIST_ENDPOINT}/presign/{s3_object_id}")
142
136
 
143
137
  return str(response)
@@ -4,7 +4,7 @@
4
4
  from typing import Optional, Dict
5
5
 
6
6
  from .globals import ICAV2_WES_SUBDOMAIN_NAME
7
- from .models import WESRequest
7
+ from .models import WESPostRequest
8
8
  from ..utils.requests_helpers import (
9
9
  get_request, get_url, patch_request, get_request_response_results, post_request
10
10
  )
@@ -45,22 +45,22 @@ def get_icav2_wes_request_response_results(
45
45
 
46
46
  def icav2_wes_patch_request(
47
47
  endpoint: str,
48
- params: Optional[Dict] = None,
48
+ json_data: Optional[Dict] = None,
49
49
  ):
50
50
  return patch_request(
51
51
  url=get_icav2_wes_url(endpoint),
52
- params=params
52
+ json_data=json_data
53
53
  )
54
54
 
55
55
 
56
56
  def icav2_wes_post_request(
57
57
  endpoint: str,
58
- params: Dict
58
+ json_data: Dict
59
59
  ):
60
60
  # Confirm param keys are valid
61
61
  return post_request(
62
62
  url=get_icav2_wes_url(endpoint),
63
- params=params
63
+ json_data=json_data
64
64
  )
65
65
 
66
66
 
@@ -8,22 +8,22 @@ from typing import Unpack
8
8
 
9
9
  from . import icav2_wes_post_request
10
10
  from .globals import ANALYSES_ENDPOINT
11
- from .models import WESRequest, WESResponse
11
+ from .models import WESPostRequest, WESResponse
12
12
 
13
13
 
14
14
  def create_icav2_wes_analysis(
15
- **kwargs: Unpack[WESRequest]
15
+ **kwargs: Unpack[WESPostRequest]
16
16
  ) -> WESResponse:
17
17
  """
18
18
  Launch an icav2 analysis in the ICAV2 WES API.
19
19
  """
20
20
  # Confirm param keys are valid
21
21
  for key in kwargs.keys():
22
- if key not in WESRequest.__annotations__:
23
- raise ValueError(f"Invalid parameter key: {key}. Valid keys are: {', '.join(WESRequest.__annotations__.keys())}")
22
+ if key not in WESPostRequest.__annotations__:
23
+ raise ValueError(f"Invalid parameter key: {key}. Valid keys are: {', '.join(WESPostRequest.__annotations__.keys())}")
24
24
 
25
25
  # Confirm param values are valid
26
26
  return icav2_wes_post_request(
27
27
  ANALYSES_ENDPOINT,
28
- params=dict(**kwargs)
28
+ json_data=dict(**kwargs)
29
29
  )
@@ -25,7 +25,7 @@ class EngineParameters(TypedDict):
25
25
  logsUri: str
26
26
 
27
27
 
28
- class WESRequest(TypedDict):
28
+ class WESPostRequest(TypedDict):
29
29
  """WES request object."""
30
30
  name: str
31
31
  inputs: Dict[str, Any]
@@ -33,6 +33,11 @@ class WESRequest(TypedDict):
33
33
  tags: NotRequired[Dict[str, Any]]
34
34
 
35
35
 
36
+ class WESPatchRequest(TypedDict):
37
+ status: str
38
+ icav2AnalysisId: NotRequired[str]
39
+
40
+
36
41
  class WESResponse(TypedDict):
37
42
  """WES response object."""
38
43
  id: str
@@ -1,26 +1,29 @@
1
1
  #!/usr/bin/env python3
2
- from typing import Optional
2
+ from typing import Unpack
3
3
 
4
4
  from . import icav2_wes_patch_request
5
5
  from .globals import ANALYSES_ENDPOINT
6
- from .models import WESResponse
6
+ from .models import WESResponse, WESPatchRequest
7
+
7
8
 
8
9
  # Get the icav2 wes analysis by analysis name
9
10
  def update_icav2_wes_analysis_status(
10
11
  icav2_wes_orcabus_id: str,
11
- status: str,
12
- icav2_analysis_id: Optional[str] = None
12
+ **kwargs: Unpack[WESPatchRequest]
13
13
  ) -> WESResponse:
14
14
  """
15
15
  Get the icav2 wes analysis by analysis name
16
16
  """
17
+ # Confirm param keys are valid
18
+ for key in kwargs.keys():
19
+ if key not in WESPatchRequest.__annotations__:
20
+ raise ValueError(f"Invalid parameter key: {key}. Valid keys are: {', '.join(WESPatchRequest.__annotations__.keys())}")
21
+
22
+
17
23
  return icav2_wes_patch_request(
18
24
  f"{ANALYSES_ENDPOINT}/{icav2_wes_orcabus_id}",
19
- params=dict(filter(
25
+ json_data=dict(filter(
20
26
  lambda kv_iter_: kv_iter_[1] is not None,
21
- {
22
- "status": status,
23
- "icav2AnalysisId": icav2_analysis_id
24
- }.items()
27
+ kwargs.items()
25
28
  ))
26
29
  )
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
 
3
3
  from enum import Enum
4
- from typing import Literal
5
-
6
4
 
7
5
  class AthenaDMLTypes(Enum):
8
6
  # https://docs.aws.amazon.com/athena/latest/ug/data-types.html
@@ -42,7 +42,7 @@ def get_project_from_project_id(project_id: str) -> Project:
42
42
  def get_projects_list_from_project_id_list(project_id_list: List[str], accept_missing: bool = False) -> List[Project]:
43
43
  """
44
44
  Get project from the project id
45
- :param project_id:
45
+ :param project_id_list:
46
46
  :return:
47
47
  """
48
48
  # We have an internal id, convert to int
@@ -44,7 +44,7 @@ def get_sample_from_sample_id(sample_id: str) -> Sample:
44
44
  def get_samples_list_from_sample_id_list(sample_id_list: List[str], accept_missing: bool = False) -> List[Sample]:
45
45
  """
46
46
  Get sample from the sample id
47
- :param sample_id:
47
+ :param sample_id_list:
48
48
  :return:
49
49
  """
50
50
  # We have an internal id, convert to int
@@ -88,7 +88,7 @@ def get_sample_from_sample_orcabus_id(sample_orcabus_id: str) -> Sample:
88
88
  def get_samples_list_from_sample_orcabus_id_list(sample_orcabus_id_list: List[str], accept_missing: bool = False) -> List[Project]:
89
89
  """
90
90
  Get sample from the sample id
91
- :param sample_id:
91
+ :param sample_orcabus_id_list:
92
92
  :return:
93
93
  """
94
94
  # We have an internal id, convert to int
@@ -40,8 +40,8 @@ def get_subject_from_subject_id(subject_id: str) -> Subject:
40
40
 
41
41
  def get_subjects_list_from_subject_id_list(subject_id_list: List[str], accept_missing: bool = False) -> List[Sample]:
42
42
  """
43
- Get sample from the sample id
44
- :param sample_id:
43
+ Get subject objects from subject id list
44
+ :param subject_id_list:
45
45
  :return:
46
46
  """
47
47
  # We have an internal id, convert to int
@@ -74,8 +74,8 @@ def get_subject_orcabus_id_from_subject_id(subject_id: str) -> str:
74
74
 
75
75
  def get_subjects_list_from_subject_orcabus_id_list(subject_orcabus_id_list: List[str], accept_missing: bool = False) -> List[Sample]:
76
76
  """
77
- Get sample from the sample id
78
- :param sample_id:
77
+ Get subject objects from subject orcabus id list
78
+ :param subject_orcabus_id_list:
79
79
  :return:
80
80
  """
81
81
  # We have an internal id, convert to int
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- from typing import TypedDict, Literal, NotRequired, Optional, Dict
3
+ from typing import TypedDict, Literal, Optional, Dict
4
4
 
5
5
  statusLiteral = Literal['STARTED', 'FAILED', 'SUCCEEDED', 'ABORTED', 'RESOLVED']
6
6
 
@@ -9,8 +9,6 @@ from copy import deepcopy
9
9
 
10
10
  from requests import HTTPError
11
11
 
12
- from fastapi.encoders import jsonable_encoder
13
-
14
12
  # Locals
15
13
  from .aws_helpers import (
16
14
  get_orcabus_token, get_hostname
@@ -13,7 +13,7 @@ const aws_cloudwatch_actions_1 = require("aws-cdk-lib/aws-cloudwatch-actions");
13
13
  * SNS topic.
14
14
  */
15
15
  class MonitoredQueue extends constructs_1.Construct {
16
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.monitoredQueue.MonitoredQueue", version: "0.0.37" };
16
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.monitoredQueue.MonitoredQueue", version: "0.0.39" };
17
17
  queue;
18
18
  deadLetterQueue;
19
19
  alarm;
@@ -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.37" };
10
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.namedLambdaRole.NamedLambdaRole", version: "0.0.39" };
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.37",
3
+ "version": "0.0.39",
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.37" };
18
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.provider.ProviderFunction", version: "0.0.39" };
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.37" };
26
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.networking.OrcaBusVpc", version: "0.0.39" };
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.37" };
45
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.networking.OrcaBusSharedComputeSecurityGroup", version: "0.0.39" };
46
46
  /**
47
47
  * The shared security group that is used by compute resources to access the database.
48
48
  * @param scope
@@ -11,7 +11,7 @@ exports.SLACK_ALERTS_SNS_TOPIC = "AwsChatBotTopic-alerts";
11
11
  * A helper class to construct the arn for the slack SNS topic.
12
12
  */
13
13
  class SlackAlerts {
14
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.slack.SlackAlerts", version: "0.0.37" };
14
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.slack.SlackAlerts", version: "0.0.39" };
15
15
  /**
16
16
  * Format the ARN for the slack alerts SNS topic for the current stack.
17
17
  * @param stack