dayhoff-tools 1.1.33__py3-none-any.whl → 1.1.34__py3-none-any.whl
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.
- dayhoff_tools/deployment/deploy_gcp.py +54 -4
- {dayhoff_tools-1.1.33.dist-info → dayhoff_tools-1.1.34.dist-info}/METADATA +1 -1
- {dayhoff_tools-1.1.33.dist-info → dayhoff_tools-1.1.34.dist-info}/RECORD +5 -5
- {dayhoff_tools-1.1.33.dist-info → dayhoff_tools-1.1.34.dist-info}/WHEEL +0 -0
- {dayhoff_tools-1.1.33.dist-info → dayhoff_tools-1.1.34.dist-info}/entry_points.txt +0 -0
@@ -50,9 +50,55 @@ def create_batch_job_config(config: dict, image_uri: str) -> dict:
|
|
50
50
|
|
51
51
|
Returns:
|
52
52
|
Dictionary containing GCP Batch job configuration
|
53
|
+
|
54
|
+
Raises:
|
55
|
+
ValueError: If the configuration contains unexpected keys.
|
53
56
|
"""
|
54
57
|
gcp_config = config["gcp"]
|
55
58
|
|
59
|
+
# Validate top-level gcp_config keys used for Batch job JSON construction
|
60
|
+
EXPECTED_GCP_CONFIG_KEYS = {
|
61
|
+
"allocation_policy", # Goes into batch_config.allocationPolicy
|
62
|
+
"logs_policy", # Goes into batch_config.logsPolicy
|
63
|
+
"batch_job", # Contains detailed task and resource specs
|
64
|
+
# Keys like job_name, region, registry_uri, repository are used by other functions
|
65
|
+
# or for other purposes, not directly for constructing the core batch_config JSON here.
|
66
|
+
}
|
67
|
+
actual_gcp_keys = set(gcp_config.keys())
|
68
|
+
# Filter out keys not relevant to this function's direct Batch config construction
|
69
|
+
# These keys are used by the calling context or other parts of the deployment.
|
70
|
+
keys_to_ignore_for_this_check = {"job_name", "region", "registry_uri", "repository"}
|
71
|
+
relevant_gcp_keys = {
|
72
|
+
key for key in actual_gcp_keys if key not in keys_to_ignore_for_this_check
|
73
|
+
}
|
74
|
+
|
75
|
+
unhandled_gcp_keys = relevant_gcp_keys - EXPECTED_GCP_CONFIG_KEYS
|
76
|
+
if unhandled_gcp_keys:
|
77
|
+
raise ValueError(
|
78
|
+
f"Unexpected keys in 'gcp' configuration section: {unhandled_gcp_keys}. "
|
79
|
+
f"Expected keys for Batch job JSON construction are: {EXPECTED_GCP_CONFIG_KEYS}"
|
80
|
+
)
|
81
|
+
|
82
|
+
# Validate keys within gcp_config["batch_job"]
|
83
|
+
if "batch_job" not in gcp_config:
|
84
|
+
raise ValueError("Missing 'batch_job' section in 'gcp' configuration.")
|
85
|
+
|
86
|
+
gcp_batch_job_config = gcp_config["batch_job"]
|
87
|
+
EXPECTED_GCP_BATCH_JOB_KEYS = {
|
88
|
+
"taskCount",
|
89
|
+
"parallelism",
|
90
|
+
"computeResource",
|
91
|
+
"instance", # Contains machineType, accelerators
|
92
|
+
"volumes",
|
93
|
+
}
|
94
|
+
actual_batch_job_keys = set(gcp_batch_job_config.keys())
|
95
|
+
unhandled_batch_job_keys = actual_batch_job_keys - EXPECTED_GCP_BATCH_JOB_KEYS
|
96
|
+
if unhandled_batch_job_keys:
|
97
|
+
raise ValueError(
|
98
|
+
f"Unexpected keys in 'gcp.batch_job' configuration section: {unhandled_batch_job_keys}. "
|
99
|
+
f"Expected keys are: {EXPECTED_GCP_BATCH_JOB_KEYS}"
|
100
|
+
)
|
101
|
+
|
56
102
|
# Start with the allocation and logs policies
|
57
103
|
batch_config = {
|
58
104
|
"allocationPolicy": gcp_config["allocation_policy"],
|
@@ -92,10 +138,10 @@ def create_batch_job_config(config: dict, image_uri: str) -> dict:
|
|
92
138
|
|
93
139
|
# Build the task group configuration
|
94
140
|
task_group = {
|
95
|
-
"taskCount":
|
96
|
-
"parallelism":
|
141
|
+
"taskCount": gcp_batch_job_config["taskCount"],
|
142
|
+
"parallelism": gcp_batch_job_config["parallelism"],
|
97
143
|
"taskSpec": {
|
98
|
-
"computeResource":
|
144
|
+
"computeResource": gcp_batch_job_config["computeResource"],
|
99
145
|
"runnables": [{"container": container_config}],
|
100
146
|
},
|
101
147
|
}
|
@@ -107,8 +153,12 @@ def create_batch_job_config(config: dict, image_uri: str) -> dict:
|
|
107
153
|
if env_vars:
|
108
154
|
task_group["taskSpec"]["runnables"][0]["environment"] = {"variables": env_vars}
|
109
155
|
|
156
|
+
# Add volumes to the taskSpec if specified in the config
|
157
|
+
if "volumes" in gcp_batch_job_config and gcp_batch_job_config["volumes"]:
|
158
|
+
task_group["taskSpec"]["volumes"] = gcp_batch_job_config["volumes"]
|
159
|
+
|
110
160
|
# Add machine type and optional accelerators from instance config
|
111
|
-
instance_config =
|
161
|
+
instance_config = gcp_batch_job_config["instance"]
|
112
162
|
if "machineType" in instance_config:
|
113
163
|
# Add machine type to the allocation policy
|
114
164
|
if "policy" not in batch_config["allocationPolicy"]["instances"]:
|
@@ -8,7 +8,7 @@ dayhoff_tools/cli/swarm_commands.py,sha256=5EyKj8yietvT5lfoz8Zx0iQvVaNgc3SJX1z2z
|
|
8
8
|
dayhoff_tools/cli/utility_commands.py,sha256=ER4VrJt4hu904MwrcltUXjwBWT4uFrP-aPXjdXyT3F8,24685
|
9
9
|
dayhoff_tools/deployment/base.py,sha256=8tXwsPYvRo-zV-aNhHw1c7Rji-KWg8S5xoCCznFnVVI,17412
|
10
10
|
dayhoff_tools/deployment/deploy_aws.py,sha256=O0gQxHioSU_sNU8T8MD4wSOPvWc--V8eRRZzlRu035I,16446
|
11
|
-
dayhoff_tools/deployment/deploy_gcp.py,sha256=
|
11
|
+
dayhoff_tools/deployment/deploy_gcp.py,sha256=jiEE_tBVeSavAI8o_6qPDPpaoXKexcaNIa4uXcv3y0M,8839
|
12
12
|
dayhoff_tools/deployment/deploy_utils.py,sha256=StFwbqnr2_FWiKVg3xnJF4kagTHzndqqDkpaIOaAn_4,26027
|
13
13
|
dayhoff_tools/deployment/job_runner.py,sha256=hljvFpH2Bw96uYyUup5Ths72PZRL_X27KxlYzBMgguo,5086
|
14
14
|
dayhoff_tools/deployment/processors.py,sha256=q2io07xO6f6twEH1iLz9GFoGaKh76qC4kcv519Q2G7g,34583
|
@@ -26,7 +26,7 @@ dayhoff_tools/intake/uniprot.py,sha256=BZYJQF63OtPcBBnQ7_P9gulxzJtqyorgyuDiPeOJq
|
|
26
26
|
dayhoff_tools/logs.py,sha256=DKdeP0k0kliRcilwvX0mUB2eipO5BdWUeHwh-VnsICs,838
|
27
27
|
dayhoff_tools/sqlite.py,sha256=jV55ikF8VpTfeQqqlHSbY8OgfyfHj8zgHNpZjBLos_E,18672
|
28
28
|
dayhoff_tools/warehouse.py,sha256=TqV8nex1AluNaL4JuXH5zuu9P7qmE89lSo6f_oViy6U,14965
|
29
|
-
dayhoff_tools-1.1.
|
30
|
-
dayhoff_tools-1.1.
|
31
|
-
dayhoff_tools-1.1.
|
32
|
-
dayhoff_tools-1.1.
|
29
|
+
dayhoff_tools-1.1.34.dist-info/METADATA,sha256=-fobKYRniLRERxoTFy2_twRo1vgGMzlUabXPVNY8NcI,2843
|
30
|
+
dayhoff_tools-1.1.34.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
31
|
+
dayhoff_tools-1.1.34.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
|
32
|
+
dayhoff_tools-1.1.34.dist-info/RECORD,,
|
File without changes
|
File without changes
|