@orcabus/platform-cdk-constructs 0.0.101 → 0.0.103
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 +2 -2
- package/api-gateway/api-gateway.js +1 -1
- package/deployment-stack-pipeline/artifact-bucket.js +1 -1
- package/deployment-stack-pipeline/pipeline.js +1 -1
- package/dynamodb/index.js +2 -2
- package/ecs/index.js +1 -1
- package/eventbridge-rules/sfn-slack-notification.js +1 -1
- package/lambda/index.js +1 -1
- package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/fastq/query_helpers.py +2 -1
- package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/filemanager/file_helpers.py +4 -2
- package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/metadata/__init__.py +15 -2
- package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/metadata/contact_helpers.py +41 -2
- package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/metadata/individual_helpers.py +2 -1
- package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/metadata/library_helpers.py +74 -24
- package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/sequence/__init__.py +13 -3
- package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/sequence/sequence_helpers.py +11 -13
- package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/utils/requests_helpers.py +14 -7
- package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/workflow/query_helpers.py +12 -2
- package/monitored-queue/index.js +1 -1
- package/named-lambda-role/index.js +1 -1
- package/package.json +1 -1
- package/provider-function/index.js +1 -1
- package/shared-config/networking.js +2 -2
- package/shared-config/slack.js +1 -1
package/.jsii
CHANGED
|
@@ -7163,6 +7163,6 @@
|
|
|
7163
7163
|
"symbolId": "shared-config/slack:SlackAlerts"
|
|
7164
7164
|
}
|
|
7165
7165
|
},
|
|
7166
|
-
"version": "0.0.
|
|
7167
|
-
"fingerprint": "
|
|
7166
|
+
"version": "0.0.103",
|
|
7167
|
+
"fingerprint": "KVtXLtl1tuxWjiSlZCglYRUWXmEKulQI+uU7aRR6yf8="
|
|
7168
7168
|
}
|
|
@@ -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.
|
|
18
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.apigateway.OrcaBusApiGateway", version: "0.0.103" };
|
|
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
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.CrossDeploymentArtifactBucket", version: "0.0.103" };
|
|
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.
|
|
35
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.deploymentPipeline.DeploymentStackPipeline", version: "0.0.103" };
|
|
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.
|
|
43
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.dynamodb.DynamoDbPartitionedConstruct", version: "0.0.103" };
|
|
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.
|
|
78
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.dynamodb.DynamoDbNonPartitionedConstruct", version: "0.0.103" };
|
|
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.
|
|
58
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.ecs.EcsFargateTaskConstruct", version: "0.0.103" };
|
|
59
59
|
cluster;
|
|
60
60
|
taskDefinition;
|
|
61
61
|
taskExecutionRole;
|
|
@@ -17,7 +17,7 @@ var SfnEventStatus;
|
|
|
17
17
|
SfnEventStatus["ABORTED"] = "ABORTED";
|
|
18
18
|
})(SfnEventStatus || (exports.SfnEventStatus = SfnEventStatus = {}));
|
|
19
19
|
class SfnSlackNotification extends constructs_1.Construct {
|
|
20
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.eventbridgeRule.SfnSlackNotification", version: "0.0.
|
|
20
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.eventbridgeRule.SfnSlackNotification", version: "0.0.103" };
|
|
21
21
|
rule;
|
|
22
22
|
constructor(scope, id, props) {
|
|
23
23
|
super(scope, id);
|
package/lambda/index.js
CHANGED
|
@@ -57,7 +57,7 @@ function getPythonUvDockerImage() {
|
|
|
57
57
|
return aws_cdk_lib_1.DockerImage.fromBuild(path_1.default.join(__dirname, 'build_python'));
|
|
58
58
|
}
|
|
59
59
|
class PythonUvFunction extends aws_lambda_python_alpha_1.PythonFunction {
|
|
60
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.lambda.PythonUvFunction", version: "0.0.
|
|
60
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.lambda.PythonUvFunction", version: "0.0.103" };
|
|
61
61
|
// Class constructs, to be used for caching the layers
|
|
62
62
|
// This means that if there are multiple lambdas throughout the stack
|
|
63
63
|
// They will all use the same layer
|
|
@@ -245,7 +245,8 @@ def get_presigned_urls_from_ingest_ids(ingest_ids: List[str]) -> List[Dict[str,
|
|
|
245
245
|
})
|
|
246
246
|
),
|
|
247
247
|
ingest_id_batches
|
|
248
|
-
))
|
|
248
|
+
)),
|
|
249
|
+
[]
|
|
249
250
|
))
|
|
250
251
|
|
|
251
252
|
s3_object_list = get_s3_objs_from_ingest_ids_map(ingest_ids)
|
|
@@ -303,7 +304,8 @@ def get_s3_objs_from_ingest_ids_map(
|
|
|
303
304
|
**kwargs
|
|
304
305
|
}),
|
|
305
306
|
ingest_id_batches
|
|
306
|
-
))
|
|
307
|
+
)),
|
|
308
|
+
[]
|
|
307
309
|
))
|
|
308
310
|
))
|
|
309
311
|
except TypeError as e:
|
|
@@ -102,7 +102,8 @@ def get_item_from_item_id_list_batched(
|
|
|
102
102
|
)
|
|
103
103
|
),
|
|
104
104
|
item_id_lists
|
|
105
|
-
))
|
|
105
|
+
)),
|
|
106
|
+
[]
|
|
106
107
|
))
|
|
107
108
|
except TypeError as e:
|
|
108
109
|
# TypeError: reduce() of empty sequence with no initial value
|
|
@@ -119,6 +120,8 @@ from .contact_helpers import (
|
|
|
119
120
|
get_contacts_list_from_contact_orcabus_id_list,
|
|
120
121
|
coerce_contact_id_or_orcabus_id_to_contact_orcabus_id,
|
|
121
122
|
get_all_contacts,
|
|
123
|
+
list_libraries_for_contact_id,
|
|
124
|
+
list_libraries_for_contact_orcabus_id,
|
|
122
125
|
)
|
|
123
126
|
|
|
124
127
|
from .individual_helpers import (
|
|
@@ -145,7 +148,11 @@ from .library_helpers import (
|
|
|
145
148
|
get_library_assay_type,
|
|
146
149
|
get_library_phenotype,
|
|
147
150
|
get_library_workflow,
|
|
148
|
-
get_all_libraries
|
|
151
|
+
get_all_libraries,
|
|
152
|
+
get_project_list_from_library_orcabus_id,
|
|
153
|
+
get_project_list_from_library_id,
|
|
154
|
+
get_contact_list_from_library_orcabus_id,
|
|
155
|
+
get_contact_list_from_library_id
|
|
149
156
|
)
|
|
150
157
|
|
|
151
158
|
from .project_helpers import (
|
|
@@ -191,6 +198,8 @@ __all__ = [
|
|
|
191
198
|
"get_contacts_list_from_contact_orcabus_id_list",
|
|
192
199
|
"coerce_contact_id_or_orcabus_id_to_contact_orcabus_id",
|
|
193
200
|
"get_all_contacts",
|
|
201
|
+
"list_libraries_for_contact_id",
|
|
202
|
+
"list_libraries_for_contact_orcabus_id",
|
|
194
203
|
|
|
195
204
|
# Individual Helpers
|
|
196
205
|
"get_individual_from_individual_id",
|
|
@@ -216,6 +225,10 @@ __all__ = [
|
|
|
216
225
|
"get_library_phenotype",
|
|
217
226
|
"get_library_workflow",
|
|
218
227
|
"get_all_libraries",
|
|
228
|
+
"get_project_list_from_library_orcabus_id",
|
|
229
|
+
"get_project_list_from_library_id",
|
|
230
|
+
"get_contact_list_from_library_orcabus_id",
|
|
231
|
+
"get_contact_list_from_library_id",
|
|
219
232
|
|
|
220
233
|
# Project Helpers
|
|
221
234
|
"get_project_from_project_id",
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
"""
|
|
4
4
|
Helpers for using the contact API endpoint
|
|
5
5
|
"""
|
|
6
|
-
|
|
7
6
|
# Standard imports
|
|
7
|
+
from functools import reduce
|
|
8
|
+
from operator import concat
|
|
8
9
|
from typing import List
|
|
9
10
|
from requests import HTTPError
|
|
10
11
|
|
|
11
12
|
# Local imports
|
|
12
13
|
from . import get_metadata_request_response_results, get_item_objs_from_item_id_list
|
|
13
14
|
from .globals import CONTACT_ENDPOINT, ORCABUS_ULID_REGEX_MATCH
|
|
14
|
-
from .models import Contact
|
|
15
|
+
from .models import Contact, Library
|
|
15
16
|
from .errors import ContactNotFoundError
|
|
16
17
|
|
|
17
18
|
|
|
@@ -107,3 +108,41 @@ def get_all_contacts() -> List[Contact]:
|
|
|
107
108
|
:return:
|
|
108
109
|
"""
|
|
109
110
|
return get_metadata_request_response_results(CONTACT_ENDPOINT)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def list_libraries_for_contact_orcabus_id(contact_orcabus_id: str) -> List[Library]:
|
|
114
|
+
"""
|
|
115
|
+
Given a contact orcabus id, get libraries associated with projects, associated with the contact
|
|
116
|
+
:param contact_orcabus_id:
|
|
117
|
+
:return:
|
|
118
|
+
"""
|
|
119
|
+
from .project_helpers import list_libraries_in_project
|
|
120
|
+
|
|
121
|
+
# Get the contact object
|
|
122
|
+
contact_obj = get_contact_from_contact_orcabus_id(contact_orcabus_id)
|
|
123
|
+
|
|
124
|
+
# For each project in the projectSet, get the libraries in the project
|
|
125
|
+
library_object_list = list(reduce(
|
|
126
|
+
concat,
|
|
127
|
+
list(map(
|
|
128
|
+
lambda project_iter_: list_libraries_in_project(project_iter_['orcabusId']),
|
|
129
|
+
contact_obj.get('projectSet', [])
|
|
130
|
+
)),
|
|
131
|
+
[]
|
|
132
|
+
))
|
|
133
|
+
|
|
134
|
+
# Remove duplicates by library orcabus id
|
|
135
|
+
library_object_list = list({lib['orcabusId']: lib for lib in library_object_list}.values())
|
|
136
|
+
|
|
137
|
+
return library_object_list
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def list_libraries_for_contact_id(contact_id: str) -> List[Library]:
|
|
141
|
+
"""
|
|
142
|
+
Get libraries associated with a contact id
|
|
143
|
+
:param contact_id:
|
|
144
|
+
:return:
|
|
145
|
+
"""
|
|
146
|
+
return list_libraries_for_contact_orcabus_id(
|
|
147
|
+
get_contact_orcabus_id_from_contact_id(contact_id)
|
|
148
|
+
)
|
package/lambda/layers/orcabus_api_tools/src/orcabus_api_tools/metadata/individual_helpers.py
CHANGED
|
@@ -135,5 +135,6 @@ def list_libraries_in_individual(individual_orcabus_id: str) -> List[LibraryDeta
|
|
|
135
135
|
lambda subject_iter_: list_libraries_in_subject(subject_iter_['orcabusId']),
|
|
136
136
|
# Get list of subject orcabus ids
|
|
137
137
|
get_individual_from_individual_orcabus_id(individual_orcabus_id)["subjectSet"]
|
|
138
|
-
))
|
|
138
|
+
)),
|
|
139
|
+
[]
|
|
139
140
|
))
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
|
+
from functools import reduce
|
|
3
|
+
from operator import concat
|
|
2
4
|
from typing import Union, List
|
|
3
5
|
|
|
4
6
|
from requests import HTTPError
|
|
5
7
|
|
|
6
8
|
from .globals import LIBRARY_ENDPOINT, ORCABUS_ULID_REGEX_MATCH
|
|
7
|
-
from .models import Library, Subject
|
|
8
|
-
from . import
|
|
9
|
+
from .models import Library, Subject, Contact, Project
|
|
10
|
+
from . import (
|
|
11
|
+
get_metadata_request_response_results, get_item_objs_from_item_id_list
|
|
12
|
+
)
|
|
9
13
|
from .errors import LibraryNotFoundError
|
|
10
14
|
|
|
11
15
|
|
|
@@ -166,31 +170,77 @@ def get_library_workflow(library_id: str) -> Union[str | None]:
|
|
|
166
170
|
return library.get("workflow")
|
|
167
171
|
|
|
168
172
|
|
|
169
|
-
# def get_library_project_owner(library_id: str) -> Union[str | None]:
|
|
170
|
-
# """
|
|
171
|
-
# Given a library id, collect the library project owner
|
|
172
|
-
# :param library_id:
|
|
173
|
-
# :return:
|
|
174
|
-
# """
|
|
175
|
-
# library = get_library_from_library_id(library_id)
|
|
176
|
-
#
|
|
177
|
-
# return library.get("projectOwner")
|
|
178
|
-
#
|
|
179
|
-
#
|
|
180
|
-
# def get_library_project_name(library_id: str) -> Union[str | None]:
|
|
181
|
-
# """
|
|
182
|
-
# Given a library id, collect the library workflow
|
|
183
|
-
# :param library_id:
|
|
184
|
-
# :return:
|
|
185
|
-
# """
|
|
186
|
-
# library = get_library_from_library_id(library_id)
|
|
187
|
-
#
|
|
188
|
-
# return library.get("projectName")
|
|
189
|
-
|
|
190
|
-
|
|
191
173
|
def get_all_libraries() -> List[Library]:
|
|
192
174
|
"""
|
|
193
175
|
Collect all libraries from the database
|
|
194
176
|
:return:
|
|
195
177
|
"""
|
|
196
178
|
return get_metadata_request_response_results(LIBRARY_ENDPOINT)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def get_project_list_from_library_orcabus_id(library_orcabus_id: str) -> List[Project]:
|
|
182
|
+
"""
|
|
183
|
+
Given a library orcabus id, collect the project list
|
|
184
|
+
:param library_orcabus_id:
|
|
185
|
+
:return:
|
|
186
|
+
"""
|
|
187
|
+
# Local imports
|
|
188
|
+
from .project_helpers import get_project_from_project_orcabus_id
|
|
189
|
+
|
|
190
|
+
# For each project in the projectSet, get the project (convert from ProjectDetail to Project)
|
|
191
|
+
# Then return the list
|
|
192
|
+
return list(map(
|
|
193
|
+
lambda project_iter_: get_project_from_project_orcabus_id(project_iter_['orcabusId']),
|
|
194
|
+
get_library_from_library_orcabus_id(library_orcabus_id).get("projectSet", [])
|
|
195
|
+
))
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def get_project_list_from_library_id(library_id: str) -> List[Project]:
|
|
199
|
+
"""
|
|
200
|
+
Given a library id, collect the project list
|
|
201
|
+
:param library_id:
|
|
202
|
+
:return:
|
|
203
|
+
"""
|
|
204
|
+
return get_project_list_from_library_orcabus_id(get_library_orcabus_id_from_library_id(library_id))
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def get_contact_list_from_library_orcabus_id(library_orcabus_id: str) -> List[Contact]:
|
|
208
|
+
"""
|
|
209
|
+
Given a library orcabus id, collect the contact list
|
|
210
|
+
:param library_orcabus_id:
|
|
211
|
+
:return:
|
|
212
|
+
"""
|
|
213
|
+
# Local imports
|
|
214
|
+
from .project_helpers import get_project_from_project_orcabus_id
|
|
215
|
+
from .contact_helpers import get_contact_from_contact_orcabus_id
|
|
216
|
+
|
|
217
|
+
# For each project in the projectSet,
|
|
218
|
+
# Get the contact set, then we reduce to a single list
|
|
219
|
+
contact_list = list(reduce(
|
|
220
|
+
concat,
|
|
221
|
+
list(map(
|
|
222
|
+
lambda project_iter_: get_project_from_project_orcabus_id(project_iter_['orcabusId']).get('contactSet', []),
|
|
223
|
+
get_library_from_library_orcabus_id(library_orcabus_id).get("projectSet", [])
|
|
224
|
+
)),
|
|
225
|
+
[]
|
|
226
|
+
))
|
|
227
|
+
|
|
228
|
+
# We need to deduplicate the contact list
|
|
229
|
+
contact_list = list({contact_iter_['orcabusId']: contact_iter_ for contact_iter_ in contact_list}.values())
|
|
230
|
+
|
|
231
|
+
# Then convert from ContactDetail to Contact objects by fetching each contact
|
|
232
|
+
contact_list = list(map(
|
|
233
|
+
lambda contact_iter_: get_contact_from_contact_orcabus_id(contact_iter_['orcabusId']),
|
|
234
|
+
contact_list
|
|
235
|
+
))
|
|
236
|
+
|
|
237
|
+
return contact_list
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def get_contact_list_from_library_id(library_id: str) -> List[Contact]:
|
|
241
|
+
"""
|
|
242
|
+
Given a library id, collect the contact list
|
|
243
|
+
:param library_id:
|
|
244
|
+
:return:
|
|
245
|
+
"""
|
|
246
|
+
return get_contact_list_from_library_orcabus_id(get_library_orcabus_id_from_library_id(library_id))
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
|
|
3
3
|
# Standard imports
|
|
4
|
-
from
|
|
4
|
+
from io import BufferedReader
|
|
5
|
+
from typing import Dict, Optional, Tuple
|
|
5
6
|
|
|
6
7
|
# Local imports
|
|
7
8
|
from ..utils.requests_helpers import (
|
|
@@ -43,11 +44,20 @@ def get_sequence_request_response_results(
|
|
|
43
44
|
def sequence_post_request(
|
|
44
45
|
endpoint: str,
|
|
45
46
|
json_data: Optional[Dict] = None,
|
|
47
|
+
files: Optional[Dict[str, Tuple[str, BufferedReader, str]]] = None,
|
|
46
48
|
) -> Dict:
|
|
49
|
+
"""
|
|
50
|
+
Waap POST request with sequence base url
|
|
51
|
+
:param endpoint:
|
|
52
|
+
:param json_data:
|
|
53
|
+
:param files:
|
|
54
|
+
:return:
|
|
55
|
+
"""
|
|
47
56
|
return post_request(
|
|
48
57
|
get_sequence_url(endpoint),
|
|
49
|
-
json_data=json_data
|
|
50
|
-
|
|
58
|
+
json_data=json_data,
|
|
59
|
+
files=files,
|
|
60
|
+
)
|
|
51
61
|
|
|
52
62
|
|
|
53
63
|
from .sequence_helpers import (
|
|
@@ -135,21 +135,19 @@ def add_samplesheet(
|
|
|
135
135
|
"""
|
|
136
136
|
Add a sample sheet to the sequence run.
|
|
137
137
|
:param instrument_run_id: The instrument run identifier for which the sample sheet is being added.
|
|
138
|
-
:param
|
|
138
|
+
:param samplesheet_path: Path to the sample sheet file to be uploaded.
|
|
139
139
|
:param created_by: The user who is adding the sample sheet.
|
|
140
140
|
:param comment: A comment describing the sample sheet or the reason for adding it.
|
|
141
141
|
:return: Response from the API containing the updated sequence information.
|
|
142
142
|
"""
|
|
143
143
|
# Open the sample sheet file
|
|
144
|
-
with open(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
)
|
|
144
|
+
with open(samplesheet_path, 'rb') as file_data:
|
|
145
|
+
return sequence_post_request(
|
|
146
|
+
endpoint=f"{SEQUENCE_RUN_ENDPOINT}/action/add_samplesheet/",
|
|
147
|
+
files={
|
|
148
|
+
"file": ("SampleSheet.csv", file_data, 'text/csv'),
|
|
149
|
+
"instrument_run_id": (None, instrument_run_id),
|
|
150
|
+
"created_by": (None, created_by),
|
|
151
|
+
"comment": (None, comment),
|
|
152
|
+
}
|
|
153
|
+
)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
import json
|
|
3
|
-
from typing import Dict, Optional, List, Union
|
|
4
|
-
from urllib.parse import urlunparse, unquote, urlparse, parse_qs
|
|
5
2
|
|
|
6
3
|
# Standard imports
|
|
4
|
+
import json
|
|
7
5
|
import requests
|
|
6
|
+
from io import BufferedReader
|
|
7
|
+
from typing import Dict, Optional, List, Union, Tuple
|
|
8
|
+
from urllib.parse import urlunparse, unquote, urlparse, parse_qs
|
|
8
9
|
import logging
|
|
9
10
|
from copy import deepcopy
|
|
10
|
-
|
|
11
11
|
from fastapi.encoders import jsonable_encoder
|
|
12
12
|
from requests import HTTPError
|
|
13
13
|
|
|
@@ -159,13 +159,15 @@ def patch_request(
|
|
|
159
159
|
def post_request(
|
|
160
160
|
url: str,
|
|
161
161
|
json_data: Optional[Dict] = None,
|
|
162
|
-
params: Optional[Dict] = None
|
|
162
|
+
params: Optional[Dict] = None,
|
|
163
|
+
files: Optional[Dict[str, Tuple[str, BufferedReader, str]]] = None,
|
|
163
164
|
) -> Dict:
|
|
164
165
|
"""
|
|
165
166
|
Run post request against the fastq endpoint
|
|
166
167
|
:param json_data:
|
|
167
168
|
:param url:
|
|
168
169
|
:param params:
|
|
170
|
+
:param files:
|
|
169
171
|
:return:
|
|
170
172
|
"""
|
|
171
173
|
# Get authorization header
|
|
@@ -173,7 +175,11 @@ def post_request(
|
|
|
173
175
|
"Authorization": f"Bearer {get_orcabus_token()}",
|
|
174
176
|
}
|
|
175
177
|
|
|
176
|
-
|
|
178
|
+
# Set content type headers
|
|
179
|
+
if files is not None:
|
|
180
|
+
# Let requests set the content type for multipart
|
|
181
|
+
pass
|
|
182
|
+
elif json_data is not None:
|
|
177
183
|
headers.update({
|
|
178
184
|
"Content-Type": "application/json"
|
|
179
185
|
})
|
|
@@ -183,7 +189,8 @@ def post_request(
|
|
|
183
189
|
url,
|
|
184
190
|
headers=headers,
|
|
185
191
|
json=json_data,
|
|
186
|
-
params=params
|
|
192
|
+
params=params,
|
|
193
|
+
files=files,
|
|
187
194
|
)
|
|
188
195
|
|
|
189
196
|
try:
|
|
@@ -28,7 +28,8 @@ def list_workflow_runs(
|
|
|
28
28
|
:param current_status:
|
|
29
29
|
:return:
|
|
30
30
|
"""
|
|
31
|
-
|
|
31
|
+
# Get workflow runs
|
|
32
|
+
workflow_runs = get_workflow_request_response_results(
|
|
32
33
|
WORKFLOW_RUN_ENDPOINT,
|
|
33
34
|
params=dict(filter(
|
|
34
35
|
lambda item: item[1] is not None,
|
|
@@ -36,12 +37,21 @@ def list_workflow_runs(
|
|
|
36
37
|
"workflow__name": workflow_name,
|
|
37
38
|
"workflow__version": workflow_version,
|
|
38
39
|
"workflow__codeVersion": code_version,
|
|
39
|
-
"currentState__status": current_status,
|
|
40
40
|
"analysisRun__orcabusId": analysis_run_id
|
|
41
41
|
}.items()
|
|
42
42
|
))
|
|
43
43
|
)
|
|
44
44
|
|
|
45
|
+
# Check if status is set?
|
|
46
|
+
if current_status is None:
|
|
47
|
+
return workflow_runs
|
|
48
|
+
|
|
49
|
+
# Filter by status
|
|
50
|
+
return list(filter(
|
|
51
|
+
lambda workflow_run_iter_: workflow_run_iter_.get("currentState", {}).get("status") == current_status,
|
|
52
|
+
workflow_runs
|
|
53
|
+
))
|
|
54
|
+
|
|
45
55
|
|
|
46
56
|
# Deprecated
|
|
47
57
|
def list_workflow_runs_by_workflow_name(
|
package/monitored-queue/index.js
CHANGED
|
@@ -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.
|
|
16
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.monitoredQueue.MonitoredQueue", version: "0.0.103" };
|
|
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.
|
|
10
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.namedLambdaRole.NamedLambdaRole", version: "0.0.103" };
|
|
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
|
@@ -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.
|
|
18
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.provider.ProviderFunction", version: "0.0.103" };
|
|
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.
|
|
26
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.networking.OrcaBusVpc", version: "0.0.103" };
|
|
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.
|
|
45
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.networking.OrcaBusSharedComputeSecurityGroup", version: "0.0.103" };
|
|
46
46
|
/**
|
|
47
47
|
* The shared security group that is used by compute resources to access the database.
|
|
48
48
|
* @param scope
|
package/shared-config/slack.js
CHANGED
|
@@ -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.
|
|
14
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@orcabus/platform-cdk-constructs.sharedConfig.slack.SlackAlerts", version: "0.0.103" };
|
|
15
15
|
/**
|
|
16
16
|
* Format the ARN for the slack alerts SNS topic for the current stack.
|
|
17
17
|
* @param stack
|