gen3-dataops-toolkit 3.3.0__tar.gz → 3.5.0__tar.gz
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.
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/PKG-INFO +42 -1
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/README.md +41 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/pyproject.toml +1 -1
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/config_cmds.py +33 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/dict_cmds.py +9 -1
- gen3_dataops_toolkit-3.5.0/src/g3dt/cli/k8s.py +104 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/synth.py +102 -8
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/config.py +55 -2
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/k8s_ops/argocd_restart_etl.sh +4 -3
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/k8s_ops/argocd_restart_ms.sh +14 -3
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/k8s_ops/argocd_restart_schema.sh +15 -5
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/synthetic_data/generate_synth_metadata.sh +16 -10
- gen3_dataops_toolkit-3.3.0/src/g3dt/cli/k8s.py +0 -54
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/__init__.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/__init__.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/_internal/__init__.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/_internal/dispatch.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/_internal/registry.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/_internal/resolve.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/_internal/runner.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/_internal/safety.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/delete_cmds.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/ec2_cmds.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/indexd_cmds.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/jobs.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/main.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/metadata.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/pipeline_cmds.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/release_cmds.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/indexd/__init__.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/indexd/file_access.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/indexd/indexd_registrar.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/ingest/ingest.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/resolver.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/delete/delete_all_metadata_for_project.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/delete/delete_metadata.sh +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/delete/delete_metadata_by_guid.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/dictionary/deploy_dd.sh +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/dictionary/pull_dict.sh +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/dictionary/upload_dictionary.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/indexd/register_indexd.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/indexd/verify_file_access.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/k8s_ops/login_to_pod.sh +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/k8s_ops/restart_etl_and_ms.sh +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/synthetic_data/delete_synth_metadata_sheepdog.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/synthetic_data/full_deploy_dd_and_synth.sh +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/synthetic_data/upload_synth_metadata_sheepdog.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/upload/metadata/upload_all_studies.sh +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/upload/metadata/upload_metadata.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/upload/__init__.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/upload/metadata_deleter.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/upload/metadata_submitter.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/upload/upload_synthdata_s3.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/utils/athena_utils.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/utils/dbt_utils.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/utils/release_writer.py +0 -0
- {gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/validate/validate.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gen3-dataops-toolkit
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.5.0
|
|
4
4
|
Summary: Gen3 DataOps toolkit (g3dt): operate SSM-published Gen3 data pipeline environments
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Author: JoshuaHarris391
|
|
@@ -182,6 +182,47 @@ Synthetic data is only schema-valid against the dictionary that generated it, so
|
|
|
182
182
|
refuses a batch that doesn't match the version being uploaded (override with
|
|
183
183
|
`--allow-version-mismatch`).
|
|
184
184
|
|
|
185
|
+
### Synthetic data: LLM configuration
|
|
186
|
+
|
|
187
|
+
`synth generate --llm` and `synth deploy` generate LLM-realistic values with
|
|
188
|
+
[gen3-metadata-simulator](https://github.com/AustralianBioCommons/gen3-metadata-simulator).
|
|
189
|
+
The provider and model resolve with precedence **CLI flags > SSM > default**:
|
|
190
|
+
the CDK config's optional `llm` block publishes `app/llm_provider` /
|
|
191
|
+
`app/llm_model` to SSM, so every operator gets the deployment's values, and
|
|
192
|
+
`--llm-provider` / `--llm-model` override them for one run (e.g. to try a
|
|
193
|
+
model before adding it to the CDK config). Environments deployed without the
|
|
194
|
+
block fall back to provider `anthropic`, and the `--llm` path errors with
|
|
195
|
+
guidance when no model is configured anywhere.
|
|
196
|
+
|
|
197
|
+
Only the API key stays local — as a *path* to the file holding it, never the
|
|
198
|
+
key itself, set once per operator:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
g3dt config set llm_api_key_file ~/.g3dt/anthropic_api_key
|
|
202
|
+
g3dt synth generate AusDiab_Simulated --llm -n 5 -e test
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
(or per run with `--llm-api-key-file`; the vendor env var `ANTHROPIC_API_KEY`
|
|
206
|
+
/ `OPENAI_API_KEY` also works as a fallback.) The old `~/.g3dt/.env`
|
|
207
|
+
(`LLM_PROVIDER`/`LLM_MODEL`/`LLM_API_KEY_FILE`) is **no longer read**.
|
|
208
|
+
`g3dt config show --env <env>` prints the resolved provider, model, and key
|
|
209
|
+
path.
|
|
210
|
+
|
|
211
|
+
### Kubernetes restart targets
|
|
212
|
+
|
|
213
|
+
`k8s restart-schema`, `k8s restart-ms`, `dict deploy`, and `synth deploy`
|
|
214
|
+
restart the commons' schema microservices **serially, in a configured order**,
|
|
215
|
+
waiting for each rollout to go Healthy before the next; `k8s restart-etl` and
|
|
216
|
+
the deploy flows run a named ETL cronjob. Both targets resolve with precedence
|
|
217
|
+
**CLI flags > SSM > default**: the CDK config's optional `k8s` block publishes
|
|
218
|
+
`app/restart_services` (comma-separated deployment names) and
|
|
219
|
+
`app/etl_cronjob`, `--restart-services` / `--etl-cronjob` override them for
|
|
220
|
+
one run, and environments deployed without the block keep the classic Gen3 set
|
|
221
|
+
(`sheepdog-deployment,peregrine-deployment,guppy-deployment,portal-deployment`
|
|
222
|
+
/ `etl-cronjob`). A commons that manages some service outside this flow (e.g.
|
|
223
|
+
a manually redeployed frontend) simply omits it from the list in its wrapper
|
|
224
|
+
config. `g3dt config show --env <env>` prints the resolved values.
|
|
225
|
+
|
|
185
226
|
## Verifying download access (check-download)
|
|
186
227
|
|
|
187
228
|
Registration alone does not prove a file can be downloaded. Two failure modes
|
|
@@ -148,6 +148,47 @@ Synthetic data is only schema-valid against the dictionary that generated it, so
|
|
|
148
148
|
refuses a batch that doesn't match the version being uploaded (override with
|
|
149
149
|
`--allow-version-mismatch`).
|
|
150
150
|
|
|
151
|
+
### Synthetic data: LLM configuration
|
|
152
|
+
|
|
153
|
+
`synth generate --llm` and `synth deploy` generate LLM-realistic values with
|
|
154
|
+
[gen3-metadata-simulator](https://github.com/AustralianBioCommons/gen3-metadata-simulator).
|
|
155
|
+
The provider and model resolve with precedence **CLI flags > SSM > default**:
|
|
156
|
+
the CDK config's optional `llm` block publishes `app/llm_provider` /
|
|
157
|
+
`app/llm_model` to SSM, so every operator gets the deployment's values, and
|
|
158
|
+
`--llm-provider` / `--llm-model` override them for one run (e.g. to try a
|
|
159
|
+
model before adding it to the CDK config). Environments deployed without the
|
|
160
|
+
block fall back to provider `anthropic`, and the `--llm` path errors with
|
|
161
|
+
guidance when no model is configured anywhere.
|
|
162
|
+
|
|
163
|
+
Only the API key stays local — as a *path* to the file holding it, never the
|
|
164
|
+
key itself, set once per operator:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
g3dt config set llm_api_key_file ~/.g3dt/anthropic_api_key
|
|
168
|
+
g3dt synth generate AusDiab_Simulated --llm -n 5 -e test
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
(or per run with `--llm-api-key-file`; the vendor env var `ANTHROPIC_API_KEY`
|
|
172
|
+
/ `OPENAI_API_KEY` also works as a fallback.) The old `~/.g3dt/.env`
|
|
173
|
+
(`LLM_PROVIDER`/`LLM_MODEL`/`LLM_API_KEY_FILE`) is **no longer read**.
|
|
174
|
+
`g3dt config show --env <env>` prints the resolved provider, model, and key
|
|
175
|
+
path.
|
|
176
|
+
|
|
177
|
+
### Kubernetes restart targets
|
|
178
|
+
|
|
179
|
+
`k8s restart-schema`, `k8s restart-ms`, `dict deploy`, and `synth deploy`
|
|
180
|
+
restart the commons' schema microservices **serially, in a configured order**,
|
|
181
|
+
waiting for each rollout to go Healthy before the next; `k8s restart-etl` and
|
|
182
|
+
the deploy flows run a named ETL cronjob. Both targets resolve with precedence
|
|
183
|
+
**CLI flags > SSM > default**: the CDK config's optional `k8s` block publishes
|
|
184
|
+
`app/restart_services` (comma-separated deployment names) and
|
|
185
|
+
`app/etl_cronjob`, `--restart-services` / `--etl-cronjob` override them for
|
|
186
|
+
one run, and environments deployed without the block keep the classic Gen3 set
|
|
187
|
+
(`sheepdog-deployment,peregrine-deployment,guppy-deployment,portal-deployment`
|
|
188
|
+
/ `etl-cronjob`). A commons that manages some service outside this flow (e.g.
|
|
189
|
+
a manually redeployed frontend) simply omits it from the list in its wrapper
|
|
190
|
+
config. `g3dt config show --env <env>` prints the resolved values.
|
|
191
|
+
|
|
151
192
|
## Verifying download access (check-download)
|
|
152
193
|
|
|
153
194
|
Registration alone does not prove a file can be downloaded. Two failure modes
|
|
@@ -118,6 +118,15 @@ def show(
|
|
|
118
118
|
typer.echo(f" namespace : {e.namespace}")
|
|
119
119
|
typer.echo(f" cluster_name : {e.cluster_name}")
|
|
120
120
|
typer.echo(f" ec2_instance_id : {e.ec2_instance_id}")
|
|
121
|
+
# Synthetic-data LLM facts: provider/model from SSM (the CDK's optional
|
|
122
|
+
# llm block); only the key *path* is local, from the marker.
|
|
123
|
+
typer.echo(f" llm_provider : {e.llm_provider}")
|
|
124
|
+
typer.echo(f" llm_model : {e.llm_model or '(not set — pass --llm-model or add the llm block to the CDK config)'}")
|
|
125
|
+
typer.echo(f" llm_api_key_file : {config.llm_api_key_file() or '(not set — g3dt config set llm_api_key_file <path>)'}")
|
|
126
|
+
# k8s restart targets: from SSM (the CDK's optional k8s block), restarted
|
|
127
|
+
# in the listed order by restart-schema/restart-ms/dict deploy/synth deploy.
|
|
128
|
+
typer.echo(f" restart_services : {e.restart_services}")
|
|
129
|
+
typer.echo(f" etl_cronjob : {e.etl_cronjob}")
|
|
121
130
|
if study:
|
|
122
131
|
s = study_of(study, env)
|
|
123
132
|
typer.secho(f"Study: {study} -> {s.key}", bold=True)
|
|
@@ -199,6 +208,30 @@ def diff(
|
|
|
199
208
|
check(f"gen3.{camel}", gen3.get(camel), rc.get(f"app/{leaf}"))
|
|
200
209
|
check("toolkitVersion", inputs.get("toolkitVersion"), rc.get("meta/toolkitVersion"))
|
|
201
210
|
|
|
211
|
+
# Optional inputs: compared only when the file defines them — an absent
|
|
212
|
+
# input legitimately publishes no SSM parameter (or, for the dictionary
|
|
213
|
+
# fields, predates their addition), so absence on both sides is not drift.
|
|
214
|
+
for camel, leaf in {
|
|
215
|
+
"dictionaryBaseUrl": "dictionary_base_url",
|
|
216
|
+
"dictionaryPath": "dictionary_path",
|
|
217
|
+
}.items():
|
|
218
|
+
if camel in gen3:
|
|
219
|
+
check(f"gen3.{camel}", gen3.get(camel), rc.get(f"app/{leaf}"))
|
|
220
|
+
llm = inputs.get("llm") or {}
|
|
221
|
+
for camel, leaf in {"provider": "llm_provider", "model": "llm_model"}.items():
|
|
222
|
+
if camel in llm:
|
|
223
|
+
check(f"llm.{camel}", llm.get(camel), rc.get(f"app/{leaf}"))
|
|
224
|
+
k8s = inputs.get("k8s") or {}
|
|
225
|
+
if "schemaRestartServices" in k8s:
|
|
226
|
+
# The CDK publishes the list comma-joined; compare the same shape.
|
|
227
|
+
check(
|
|
228
|
+
"k8s.schemaRestartServices",
|
|
229
|
+
",".join(k8s.get("schemaRestartServices") or []),
|
|
230
|
+
rc.get("app/restart_services"),
|
|
231
|
+
)
|
|
232
|
+
if "etlCronjob" in k8s:
|
|
233
|
+
check("k8s.etlCronjob", k8s.get("etlCronjob"), rc.get("app/etl_cronjob"))
|
|
234
|
+
|
|
202
235
|
if not drift:
|
|
203
236
|
typer.secho(
|
|
204
237
|
f"No drift: SSM /{project}/{config.env_base(env)} matches {file}.",
|
|
@@ -103,6 +103,11 @@ def deploy(
|
|
|
103
103
|
version: str = typer.Option(
|
|
104
104
|
None, "--version", help="Dictionary git tag (default: the env's version)."
|
|
105
105
|
),
|
|
106
|
+
restart_services: Optional[str] = typer.Option(
|
|
107
|
+
None, "--restart-services",
|
|
108
|
+
help="Comma-separated deployment names restarted after the upload, in "
|
|
109
|
+
"order; default: the env's SSM app/restart_services.",
|
|
110
|
+
),
|
|
106
111
|
) -> None:
|
|
107
112
|
"""Pull + upload the dictionary and restart Gen3 schema microservices.
|
|
108
113
|
|
|
@@ -123,7 +128,10 @@ def deploy(
|
|
|
123
128
|
"""
|
|
124
129
|
e = env_of(env)
|
|
125
130
|
warn_if_overridden(e, version)
|
|
131
|
+
env_vars = script_env(e, _version(e, version))
|
|
132
|
+
if restart_services:
|
|
133
|
+
env_vars["G3DT_RESTART_SERVICES"] = restart_services
|
|
126
134
|
runner.run(
|
|
127
135
|
runner.bash_script("services/dictionary/deploy_dd.sh", env),
|
|
128
|
-
env=
|
|
136
|
+
env=env_vars,
|
|
129
137
|
)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""`g3dt k8s` — restart Gen3 microservices / ETL via ArgoCD (LOCAL only).
|
|
2
|
+
|
|
3
|
+
These use ``argocd login --sso`` (a browser flow), so they cannot run headless
|
|
4
|
+
on EC2. The wrapped scripts receive their settings as ``G3DT_*`` environment
|
|
5
|
+
variables resolved from SSM — they read no config files.
|
|
6
|
+
|
|
7
|
+
The restart targets resolve with precedence CLI flags > SSM > default: the
|
|
8
|
+
CDK config's optional ``k8s`` block publishes ``app/restart_services`` (a
|
|
9
|
+
comma-separated list, restarted in order) and ``app/etl_cronjob``;
|
|
10
|
+
``--restart-services`` / ``--etl-cronjob`` override them for one run, and
|
|
11
|
+
environments deployed without the block keep the classic Gen3 set
|
|
12
|
+
(sheepdog, peregrine, guppy, portal / etl-cronjob).
|
|
13
|
+
"""
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
from typing import Optional
|
|
17
|
+
|
|
18
|
+
import typer
|
|
19
|
+
|
|
20
|
+
from g3dt.config import script_env
|
|
21
|
+
from g3dt.cli._internal import runner
|
|
22
|
+
from g3dt.cli._internal.resolve import env_of
|
|
23
|
+
|
|
24
|
+
app = typer.Typer(no_args_is_help=True, help="ArgoCD / Kubernetes restarts (local).")
|
|
25
|
+
|
|
26
|
+
_SCHEMA = "services/k8s_ops/argocd_restart_schema.sh"
|
|
27
|
+
_ETL = "services/k8s_ops/argocd_restart_etl.sh"
|
|
28
|
+
_ETL_AND_MS = "services/k8s_ops/restart_etl_and_ms.sh"
|
|
29
|
+
|
|
30
|
+
_RESTART_SERVICES_HELP = (
|
|
31
|
+
"Comma-separated deployment names to restart, in order; default: the "
|
|
32
|
+
"env's SSM app/restart_services (the CDK config's k8s.schemaRestartServices)."
|
|
33
|
+
)
|
|
34
|
+
_ETL_CRONJOB_HELP = (
|
|
35
|
+
"ETL cronjob name; default: the env's SSM app/etl_cronjob "
|
|
36
|
+
"(the CDK config's k8s.etlCronjob)."
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def restart_env(e, restart_services: Optional[str] = None,
|
|
41
|
+
etl_cronjob: Optional[str] = None) -> dict:
|
|
42
|
+
"""script_env plus per-run restart-target overrides (flags beat SSM)."""
|
|
43
|
+
env_vars = script_env(e)
|
|
44
|
+
if restart_services:
|
|
45
|
+
env_vars["G3DT_RESTART_SERVICES"] = restart_services
|
|
46
|
+
if etl_cronjob:
|
|
47
|
+
env_vars["G3DT_ETL_CRONJOB"] = etl_cronjob
|
|
48
|
+
return env_vars
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@app.command(name="restart-schema")
|
|
52
|
+
def restart_schema(
|
|
53
|
+
env: str = typer.Option(..., "--env", "-e", help="Environment, e.g. test."),
|
|
54
|
+
sync: bool = typer.Option(False, "--sync", "-s", help="argocd app sync first."),
|
|
55
|
+
restart_services: Optional[str] = typer.Option(
|
|
56
|
+
None, "--restart-services", help=_RESTART_SERVICES_HELP
|
|
57
|
+
),
|
|
58
|
+
) -> None:
|
|
59
|
+
"""Restart the schema microservices, in the env's configured order."""
|
|
60
|
+
e = env_of(env)
|
|
61
|
+
args = ["-d", e.domain, "-a", e.app_name, "-n", e.namespace]
|
|
62
|
+
if sync:
|
|
63
|
+
args.append("-s")
|
|
64
|
+
runner.run(
|
|
65
|
+
runner.bash_script(_SCHEMA, *args),
|
|
66
|
+
env=restart_env(e, restart_services=restart_services),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@app.command(name="restart-etl")
|
|
71
|
+
def restart_etl(
|
|
72
|
+
env: str = typer.Option(..., "--env", "-e", help="Environment, e.g. test."),
|
|
73
|
+
sync: bool = typer.Option(False, "--sync", "-s", help="argocd app sync first."),
|
|
74
|
+
etl_cronjob: Optional[str] = typer.Option(
|
|
75
|
+
None, "--etl-cronjob", help=_ETL_CRONJOB_HELP
|
|
76
|
+
),
|
|
77
|
+
) -> None:
|
|
78
|
+
"""Create + run the ETL cronjob and wait for completion."""
|
|
79
|
+
e = env_of(env)
|
|
80
|
+
args = ["-e", env]
|
|
81
|
+
if sync:
|
|
82
|
+
args.append("-s")
|
|
83
|
+
runner.run(
|
|
84
|
+
runner.bash_script(_ETL, *args),
|
|
85
|
+
env=restart_env(e, etl_cronjob=etl_cronjob),
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@app.command(name="restart-ms")
|
|
90
|
+
def restart_ms(
|
|
91
|
+
env: str = typer.Option(..., "--env", "-e", help="Environment, e.g. test."),
|
|
92
|
+
restart_services: Optional[str] = typer.Option(
|
|
93
|
+
None, "--restart-services", help=_RESTART_SERVICES_HELP
|
|
94
|
+
),
|
|
95
|
+
etl_cronjob: Optional[str] = typer.Option(
|
|
96
|
+
None, "--etl-cronjob", help=_ETL_CRONJOB_HELP
|
|
97
|
+
),
|
|
98
|
+
) -> None:
|
|
99
|
+
"""Restart both ETL and schema microservices (wraps restart_etl_and_ms.sh)."""
|
|
100
|
+
e = env_of(env)
|
|
101
|
+
runner.run(
|
|
102
|
+
runner.bash_script(_ETL_AND_MS, env),
|
|
103
|
+
env=restart_env(e, restart_services=restart_services, etl_cronjob=etl_cronjob),
|
|
104
|
+
)
|
|
@@ -9,9 +9,14 @@ Every command accepts ``--env``; targeting a **production** environment (any env
|
|
|
9
9
|
whose name contains ``prod``) shows a warning and requires typing the env name to
|
|
10
10
|
confirm — it cannot be bypassed.
|
|
11
11
|
|
|
12
|
-
Generation defaults to keyless ``random`` data (no API calls). Pass ``--llm``
|
|
13
|
-
LLM-realistic values
|
|
14
|
-
|
|
12
|
+
Generation defaults to keyless ``random`` data (no API calls). Pass ``--llm``
|
|
13
|
+
for LLM-realistic values. The LLM provider and model come from the
|
|
14
|
+
environment's SSM tree (the CDK config's optional ``llm`` block, published as
|
|
15
|
+
``app/llm_provider`` / ``app/llm_model``) and can be overridden per run with
|
|
16
|
+
``--llm-provider`` / ``--llm-model``. Only the API key stays local: point at
|
|
17
|
+
its file once with ``g3dt config set llm_api_key_file <path>`` (or per run
|
|
18
|
+
with ``--llm-api-key-file``); the vendor env var ``ANTHROPIC_API_KEY`` /
|
|
19
|
+
``OPENAI_API_KEY`` also works. The old ``~/.g3dt/.env`` is no longer read.
|
|
15
20
|
"""
|
|
16
21
|
from __future__ import annotations
|
|
17
22
|
|
|
@@ -21,6 +26,7 @@ from typing import Optional
|
|
|
21
26
|
|
|
22
27
|
import typer
|
|
23
28
|
|
|
29
|
+
from g3dt import config
|
|
24
30
|
from g3dt.config import (
|
|
25
31
|
dictionary_filename,
|
|
26
32
|
dictionary_url,
|
|
@@ -38,6 +44,45 @@ app = typer.Typer(
|
|
|
38
44
|
|
|
39
45
|
SYNTH_DIR = Path("~/.g3dt/synth_metadata").expanduser()
|
|
40
46
|
|
|
47
|
+
|
|
48
|
+
def _llm_env_overrides(
|
|
49
|
+
e,
|
|
50
|
+
llm_provider: Optional[str],
|
|
51
|
+
llm_model: Optional[str],
|
|
52
|
+
llm_api_key_file: Optional[Path],
|
|
53
|
+
) -> dict:
|
|
54
|
+
"""Resolve the effective LLM settings for a run: flags > SSM > default.
|
|
55
|
+
|
|
56
|
+
Returns env-var overrides for the generator script, which forwards
|
|
57
|
+
provider/model to gen3-metadata-simulator as CLI flags (the simulator's
|
|
58
|
+
own precedence puts flags first). Exits with guidance when no model is
|
|
59
|
+
configured anywhere; the key-file path is optional — the simulator falls
|
|
60
|
+
back to the vendor env var and raises its own error if neither exists.
|
|
61
|
+
"""
|
|
62
|
+
effective_provider = llm_provider or e.llm_provider
|
|
63
|
+
effective_model = llm_model or e.llm_model
|
|
64
|
+
if not effective_model:
|
|
65
|
+
typer.secho(
|
|
66
|
+
"No LLM model configured. Set the llm block in the CDK config "
|
|
67
|
+
"(published to SSM as app/llm_model) and redeploy, or pass "
|
|
68
|
+
"--llm-model for this run.",
|
|
69
|
+
fg=typer.colors.RED,
|
|
70
|
+
err=True,
|
|
71
|
+
)
|
|
72
|
+
raise typer.Exit(1)
|
|
73
|
+
overrides = {
|
|
74
|
+
"G3DT_LLM_PROVIDER": effective_provider,
|
|
75
|
+
"G3DT_LLM_MODEL": effective_model,
|
|
76
|
+
}
|
|
77
|
+
key_file = (
|
|
78
|
+
str(Path(llm_api_key_file).expanduser())
|
|
79
|
+
if llm_api_key_file
|
|
80
|
+
else config.llm_api_key_file()
|
|
81
|
+
)
|
|
82
|
+
if key_file:
|
|
83
|
+
overrides["LLM_API_KEY_FILE"] = key_file
|
|
84
|
+
return overrides
|
|
85
|
+
|
|
41
86
|
#: Written into each generated batch so `synth upload` can tell which dictionary
|
|
42
87
|
#: produced it. A batch is only valid against that dictionary, and the directory
|
|
43
88
|
#: name alone cannot be trusted: --schema and --version are separate options, so
|
|
@@ -110,19 +155,49 @@ def deploy(
|
|
|
110
155
|
env: str = typer.Option(
|
|
111
156
|
"test", "--env", "-e", help="Target environment (prod requires typed confirmation)."
|
|
112
157
|
),
|
|
158
|
+
llm_provider: Optional[str] = typer.Option(
|
|
159
|
+
None, "--llm-provider",
|
|
160
|
+
help="LLM vendor override (anthropic|openai); default: the env's SSM app/llm_provider.",
|
|
161
|
+
),
|
|
162
|
+
llm_model: Optional[str] = typer.Option(
|
|
163
|
+
None, "--llm-model",
|
|
164
|
+
help="LLM model override; default: the env's SSM app/llm_model.",
|
|
165
|
+
),
|
|
166
|
+
llm_api_key_file: Optional[Path] = typer.Option(
|
|
167
|
+
None, "--llm-api-key-file", exists=True, dir_okay=False,
|
|
168
|
+
help="Path to the file holding the LLM API key; default: the marker's "
|
|
169
|
+
"llm_api_key_file (set once: g3dt config set llm_api_key_file <path>).",
|
|
170
|
+
),
|
|
171
|
+
restart_services: Optional[str] = typer.Option(
|
|
172
|
+
None, "--restart-services",
|
|
173
|
+
help="Comma-separated deployment names restarted during the deploy, in "
|
|
174
|
+
"order; default: the env's SSM app/restart_services.",
|
|
175
|
+
),
|
|
176
|
+
etl_cronjob: Optional[str] = typer.Option(
|
|
177
|
+
None, "--etl-cronjob",
|
|
178
|
+
help="ETL cronjob name; default: the env's SSM app/etl_cronjob.",
|
|
179
|
+
),
|
|
113
180
|
) -> None:
|
|
114
181
|
"""Full end-to-end synthetic deploy (dict + LLM-generate + upload + restarts).
|
|
115
182
|
|
|
116
183
|
Wraps services/synthetic_data/full_deploy_dd_and_synth.sh (LLM-backed
|
|
117
|
-
generation).
|
|
184
|
+
generation). Provider/model and the restart targets come from the env's
|
|
185
|
+
SSM tree unless overridden; the API key path comes from
|
|
186
|
+
--llm-api-key-file or the marker.
|
|
118
187
|
"""
|
|
119
188
|
e = env_of(env)
|
|
120
189
|
safety.confirm_prod_strict("synthetic full deploy", env)
|
|
190
|
+
env_vars = script_env(e)
|
|
191
|
+
env_vars.update(_llm_env_overrides(e, llm_provider, llm_model, llm_api_key_file))
|
|
192
|
+
if restart_services:
|
|
193
|
+
env_vars["G3DT_RESTART_SERVICES"] = restart_services
|
|
194
|
+
if etl_cronjob:
|
|
195
|
+
env_vars["G3DT_ETL_CRONJOB"] = etl_cronjob
|
|
121
196
|
runner.run(
|
|
122
197
|
runner.bash_script(
|
|
123
198
|
"services/synthetic_data/full_deploy_dd_and_synth.sh", env
|
|
124
199
|
),
|
|
125
|
-
env=
|
|
200
|
+
env=env_vars,
|
|
126
201
|
)
|
|
127
202
|
|
|
128
203
|
|
|
@@ -147,8 +222,22 @@ def generate(
|
|
|
147
222
|
llm: bool = typer.Option(
|
|
148
223
|
False,
|
|
149
224
|
"--llm",
|
|
150
|
-
help="Generate LLM-realistic values;
|
|
151
|
-
"
|
|
225
|
+
help="Generate LLM-realistic values; provider/model resolve from the "
|
|
226
|
+
"env's SSM tree (override with --llm-provider/--llm-model). Default is "
|
|
227
|
+
"keyless random data (no API key, no API calls).",
|
|
228
|
+
),
|
|
229
|
+
llm_provider: Optional[str] = typer.Option(
|
|
230
|
+
None, "--llm-provider",
|
|
231
|
+
help="LLM vendor override (anthropic|openai); default: the env's SSM app/llm_provider.",
|
|
232
|
+
),
|
|
233
|
+
llm_model: Optional[str] = typer.Option(
|
|
234
|
+
None, "--llm-model",
|
|
235
|
+
help="LLM model override; default: the env's SSM app/llm_model.",
|
|
236
|
+
),
|
|
237
|
+
llm_api_key_file: Optional[Path] = typer.Option(
|
|
238
|
+
None, "--llm-api-key-file", exists=True, dir_okay=False,
|
|
239
|
+
help="Path to the file holding the LLM API key; default: the marker's "
|
|
240
|
+
"llm_api_key_file (set once: g3dt config set llm_api_key_file <path>).",
|
|
152
241
|
),
|
|
153
242
|
seed: int = typer.Option(None, "--seed", help="RNG seed for reproducible output."),
|
|
154
243
|
schema: str = typer.Option(
|
|
@@ -227,11 +316,16 @@ def generate(
|
|
|
227
316
|
args += ["--num-records", num_records]
|
|
228
317
|
if seed is not None:
|
|
229
318
|
args += ["--seed", str(seed)]
|
|
319
|
+
env_vars = script_env(e, ver)
|
|
320
|
+
if effective_provider == "llm":
|
|
321
|
+
env_vars.update(
|
|
322
|
+
_llm_env_overrides(e, llm_provider, llm_model, llm_api_key_file)
|
|
323
|
+
)
|
|
230
324
|
runner.run(
|
|
231
325
|
runner.bash_script(
|
|
232
326
|
"services/synthetic_data/generate_synth_metadata.sh", *args
|
|
233
327
|
),
|
|
234
|
-
env=
|
|
328
|
+
env=env_vars,
|
|
235
329
|
)
|
|
236
330
|
# Only after a successful generate: runner.run raises on failure, so a
|
|
237
331
|
# half-written batch is never stamped as valid.
|
|
@@ -50,11 +50,32 @@ DEFAULT_REGION = "ap-southeast-2"
|
|
|
50
50
|
DEFAULT_DICT_BASE_URL = "https://raw.githubusercontent.com"
|
|
51
51
|
DEFAULT_DICT_PATH = "dictionary/prod_dict/acdc_schema.json"
|
|
52
52
|
|
|
53
|
+
#: Synthetic-data LLM facts, published by the CDK's OPTIONAL ``llm`` config
|
|
54
|
+
#: block as ``app/llm_provider`` / ``app/llm_model`` and consumed by
|
|
55
|
+
#: gen3-metadata-simulator through ``g3dt synth``. Optional app inputs:
|
|
56
|
+
#: environments deployed without the block fall back to this provider default.
|
|
57
|
+
#: The model deliberately has no default — ``g3dt synth`` errors with guidance
|
|
58
|
+
#: when the ``--llm`` path is used and no model is configured anywhere.
|
|
59
|
+
DEFAULT_LLM_PROVIDER = "anthropic"
|
|
60
|
+
|
|
61
|
+
#: Kubernetes restart targets, published by the CDK's OPTIONAL ``k8s`` config
|
|
62
|
+
#: block as ``app/restart_services`` (comma-separated, restarted in order) and
|
|
63
|
+
#: ``app/etl_cronjob``. Optional app inputs: environments deployed without the
|
|
64
|
+
#: block keep the classic Gen3 set. Consumed by every restart path — `g3dt
|
|
65
|
+
#: k8s restart-schema/restart-etl/restart-ms`, `dict deploy`, `synth deploy` —
|
|
66
|
+
#: via $G3DT_RESTART_SERVICES / $G3DT_ETL_CRONJOB in the service scripts.
|
|
67
|
+
DEFAULT_RESTART_SERVICES = (
|
|
68
|
+
"sheepdog-deployment,peregrine-deployment,guppy-deployment,portal-deployment"
|
|
69
|
+
)
|
|
70
|
+
DEFAULT_ETL_CRONJOB = "etl-cronjob"
|
|
71
|
+
|
|
53
72
|
#: Marker locations, most specific first.
|
|
54
73
|
MARKER_PATHS = ("g3dt.yaml", "~/.g3dt/g3dt.yaml", "/etc/g3dt/g3dt.yaml")
|
|
55
74
|
|
|
56
|
-
#: Marker keys `g3dt config set` may write.
|
|
57
|
-
|
|
75
|
+
#: Marker keys `g3dt config set` may write. ``llm_api_key_file`` is the path
|
|
76
|
+
#: to the file holding the synth LLM API key — the one LLM setting that stays
|
|
77
|
+
#: local (the provider and model come from SSM; the key never leaves the box).
|
|
78
|
+
SETTABLE_MARKER_KEYS = ("project", "region", "default_env", "llm_api_key_file")
|
|
58
79
|
|
|
59
80
|
#: Gen3 app facts mirrored to SSM /{project}/{env}/app/* by the CDK.
|
|
60
81
|
REQUIRED_APP_KEYS = (
|
|
@@ -150,6 +171,18 @@ def require_project(marker: Optional[dict] = None) -> str:
|
|
|
150
171
|
return project
|
|
151
172
|
|
|
152
173
|
|
|
174
|
+
def llm_api_key_file(marker: Optional[dict] = None) -> Optional[str]:
|
|
175
|
+
"""Path to the file holding the synth LLM API key, from the marker.
|
|
176
|
+
|
|
177
|
+
Set once per operator with ``g3dt config set llm_api_key_file <path>``.
|
|
178
|
+
Returns ``None`` when unset — gen3-metadata-simulator then falls back to
|
|
179
|
+
the vendor's standard env var (``ANTHROPIC_API_KEY`` / ``OPENAI_API_KEY``).
|
|
180
|
+
"""
|
|
181
|
+
m = marker if marker is not None else load_marker()
|
|
182
|
+
value = m.get("llm_api_key_file")
|
|
183
|
+
return str(Path(str(value)).expanduser()) if value else None
|
|
184
|
+
|
|
185
|
+
|
|
153
186
|
def set_marker_value(key: str, value: str) -> Tuple[Optional[str], str, Path]:
|
|
154
187
|
"""Set one bootstrap key in the user's marker file and write it back.
|
|
155
188
|
|
|
@@ -230,6 +263,14 @@ class EnvConfig:
|
|
|
230
263
|
# hand-built EnvConfig still composes a valid URL.
|
|
231
264
|
dictionary_base_url: str = DEFAULT_DICT_BASE_URL
|
|
232
265
|
dictionary_path: str = DEFAULT_DICT_PATH
|
|
266
|
+
# Optional synthetic-data LLM inputs (SSM app/llm_provider, app/llm_model).
|
|
267
|
+
# The model has no default on purpose: synth's --llm path checks and errors
|
|
268
|
+
# with guidance rather than silently picking a model.
|
|
269
|
+
llm_provider: str = DEFAULT_LLM_PROVIDER
|
|
270
|
+
llm_model: Optional[str] = None
|
|
271
|
+
# Optional k8s restart targets (SSM app/restart_services, app/etl_cronjob).
|
|
272
|
+
restart_services: str = DEFAULT_RESTART_SERVICES
|
|
273
|
+
etl_cronjob: str = DEFAULT_ETL_CRONJOB
|
|
233
274
|
|
|
234
275
|
|
|
235
276
|
def _app_or_default(rc, leaf: str, default: str) -> str:
|
|
@@ -289,6 +330,14 @@ def resolve_env(env: str, project: Optional[str] = None) -> EnvConfig:
|
|
|
289
330
|
rc, "dictionary_base_url", DEFAULT_DICT_BASE_URL
|
|
290
331
|
),
|
|
291
332
|
dictionary_path=_app_or_default(rc, "dictionary_path", DEFAULT_DICT_PATH),
|
|
333
|
+
# Same optional-app-fact contract: the CDK publishes these only when
|
|
334
|
+
# the config has an llm block, so absence means "use the defaults".
|
|
335
|
+
llm_provider=_app_or_default(rc, "llm_provider", DEFAULT_LLM_PROVIDER),
|
|
336
|
+
llm_model=(_app_or_default(rc, "llm_model", "") or None),
|
|
337
|
+
restart_services=_app_or_default(
|
|
338
|
+
rc, "restart_services", DEFAULT_RESTART_SERVICES
|
|
339
|
+
),
|
|
340
|
+
etl_cronjob=_app_or_default(rc, "etl_cronjob", DEFAULT_ETL_CRONJOB),
|
|
292
341
|
)
|
|
293
342
|
|
|
294
343
|
|
|
@@ -395,6 +444,10 @@ def script_env(e: EnvConfig, version: Optional[str] = None) -> Dict[str, str]:
|
|
|
395
444
|
"G3DT_NAMESPACE": e.namespace,
|
|
396
445
|
"G3DT_CLUSTER_NAME": e.cluster_name,
|
|
397
446
|
"G3DT_SCHEMA_REPO": e.schema_repo,
|
|
447
|
+
"G3DT_LLM_PROVIDER": e.llm_provider,
|
|
448
|
+
"G3DT_LLM_MODEL": e.llm_model,
|
|
449
|
+
"G3DT_RESTART_SERVICES": e.restart_services,
|
|
450
|
+
"G3DT_ETL_CRONJOB": e.etl_cronjob,
|
|
398
451
|
}
|
|
399
452
|
env.update({k: v for k, v in values.items() if v is not None})
|
|
400
453
|
return env
|
|
@@ -6,7 +6,7 @@ usage() {
|
|
|
6
6
|
echo " -d DOMAIN The domain for argocd login (example: cd.cad.test.biocommons.org.au)"
|
|
7
7
|
echo " -a APPNAME The application name (example: uatgen3)"
|
|
8
8
|
echo " -n NAMESPACE The namespace for the resources (example: cad)"
|
|
9
|
-
echo " -c ETL_CRONJOB The name of the ETL cronjob to run (default: etl-cronjob)"
|
|
9
|
+
echo " -c ETL_CRONJOB The name of the ETL cronjob to run (default: \$G3DT_ETL_CRONJOB — the env's SSM app/etl_cronjob, set by g3dt — else etl-cronjob)"
|
|
10
10
|
echo " -t CONTAINER The name of the container to check logs from (default: tube)"
|
|
11
11
|
echo " -l Bypass login"
|
|
12
12
|
echo " -s Sync the argocd app before restarting resources"
|
|
@@ -15,8 +15,9 @@ usage() {
|
|
|
15
15
|
|
|
16
16
|
set -eo pipefail
|
|
17
17
|
|
|
18
|
-
# default values
|
|
19
|
-
|
|
18
|
+
# default values. The cronjob name comes from the environment's SSM tree
|
|
19
|
+
# (app/etl_cronjob, exported by g3dt as G3DT_ETL_CRONJOB).
|
|
20
|
+
ETL_CRONJOB="${G3DT_ETL_CRONJOB:-etl-cronjob}"
|
|
20
21
|
CONTAINER_TO_CHECK="tube"
|
|
21
22
|
LOGIN_REQUIRED=true
|
|
22
23
|
SYNC_APP=false
|
|
@@ -6,8 +6,11 @@ usage() {
|
|
|
6
6
|
echo "Usage: $0 [-d DOMAIN] [-a APPNAME] [-r RESOURCES] [-n NAMESPACE] [-k KIND] [-l] [-s]"
|
|
7
7
|
echo " -d DOMAIN The domain for argocd login (example: cd.cad.test.biocommons.org.au)"
|
|
8
8
|
echo " -a APPNAME The application name (example: uatgen3)"
|
|
9
|
-
echo " -r RESOURCES Comma-separated
|
|
10
|
-
echo "
|
|
9
|
+
echo " -r RESOURCES Comma-separated microservice names, restarted in order"
|
|
10
|
+
echo " (default: \$G3DT_RESTART_SERVICES — the env's SSM"
|
|
11
|
+
echo " app/restart_services, set by g3dt — else the classic"
|
|
12
|
+
echo " sheepdog,peregrine,guppy,portal set)"
|
|
13
|
+
echo " -n NAMESPACE The namespace for the resources (default: \$G3DT_NAMESPACE)"
|
|
11
14
|
echo " -k KIND The kind of resource to restart (default: Deployment)"
|
|
12
15
|
echo " -l Bypass login"
|
|
13
16
|
echo " -s Sync the argocd app before restarting resources"
|
|
@@ -16,7 +19,10 @@ usage() {
|
|
|
16
19
|
|
|
17
20
|
set -eo pipefail
|
|
18
21
|
|
|
19
|
-
# Parse command line arguments
|
|
22
|
+
# Parse command line arguments. The restart set defaults to the environment's
|
|
23
|
+
# SSM app/restart_services (exported by g3dt as G3DT_RESTART_SERVICES).
|
|
24
|
+
IFS=',' read -r -a RESOURCES <<< "${G3DT_RESTART_SERVICES:-sheepdog-deployment,peregrine-deployment,guppy-deployment,portal-deployment}"
|
|
25
|
+
NAMESPACE="${G3DT_NAMESPACE:-}"
|
|
20
26
|
LOGIN_REQUIRED=true
|
|
21
27
|
KIND="Deployment"
|
|
22
28
|
SYNC_APP=false
|
|
@@ -52,6 +58,11 @@ while getopts "d:a:r:n:k:hls" opt; do
|
|
|
52
58
|
esac
|
|
53
59
|
done
|
|
54
60
|
|
|
61
|
+
if [ -z "$NAMESPACE" ]; then
|
|
62
|
+
echo "No namespace given: pass -n, or run via the g3dt CLI (which sets G3DT_NAMESPACE)." >&2
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
|
|
55
66
|
# Check if argocd is installed
|
|
56
67
|
if ! command -v argocd &> /dev/null
|
|
57
68
|
then
|
|
@@ -6,8 +6,11 @@ usage() {
|
|
|
6
6
|
echo "Usage: $0 [-d DOMAIN] [-a APPNAME] [-r RESOURCES] [-n NAMESPACE] [-k KIND] [-l] [-s]"
|
|
7
7
|
echo " -d DOMAIN The domain for argocd login (example: cd.cad.test.biocommons.org.au)"
|
|
8
8
|
echo " -a APPNAME The application name (example: uatgen3)"
|
|
9
|
-
echo " -r RESOURCES Comma-separated
|
|
10
|
-
echo "
|
|
9
|
+
echo " -r RESOURCES Comma-separated microservice names, restarted in order"
|
|
10
|
+
echo " (default: \$G3DT_RESTART_SERVICES — the env's SSM"
|
|
11
|
+
echo " app/restart_services, set by g3dt — else the classic"
|
|
12
|
+
echo " sheepdog,peregrine,guppy,portal set)"
|
|
13
|
+
echo " -n NAMESPACE The namespace for the resources (default: \$G3DT_NAMESPACE)"
|
|
11
14
|
echo " -k KIND The kind of resource to restart (default: Deployment)"
|
|
12
15
|
echo " -l Bypass login"
|
|
13
16
|
echo " -s Run 'argocd app sync' before restarts"
|
|
@@ -16,9 +19,11 @@ usage() {
|
|
|
16
19
|
|
|
17
20
|
set -eo pipefail
|
|
18
21
|
|
|
19
|
-
# Set default values
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
# Set default values. The restart set comes from the environment's SSM tree
|
|
23
|
+
# (app/restart_services, exported by g3dt as G3DT_RESTART_SERVICES); the
|
|
24
|
+
# classic Gen3 set is the fallback for direct invocations outside g3dt.
|
|
25
|
+
IFS=',' read -r -a RESOURCES <<< "${G3DT_RESTART_SERVICES:-sheepdog-deployment,peregrine-deployment,guppy-deployment,portal-deployment}"
|
|
26
|
+
NAMESPACE="${G3DT_NAMESPACE:-}"
|
|
22
27
|
KIND="Deployment"
|
|
23
28
|
LOGIN_REQUIRED=true
|
|
24
29
|
SYNC_APP=false
|
|
@@ -56,6 +61,11 @@ while getopts "d:a:r:n:k:hls" opt; do
|
|
|
56
61
|
esac
|
|
57
62
|
done
|
|
58
63
|
|
|
64
|
+
if [ -z "$NAMESPACE" ]; then
|
|
65
|
+
echo "No namespace given: pass -n, or run via the g3dt CLI (which sets G3DT_NAMESPACE)." >&2
|
|
66
|
+
exit 1
|
|
67
|
+
fi
|
|
68
|
+
|
|
59
69
|
# Check if argocd is installed
|
|
60
70
|
if ! command -v argocd &> /dev/null
|
|
61
71
|
then
|
|
@@ -8,14 +8,13 @@
|
|
|
8
8
|
# The tool takes a LOCAL bundled Gen3 schema file (pulled by pull_dict.sh into
|
|
9
9
|
# ~/.g3dt/schemas/acdc_schema_<version>.json, or $G3DT_SCHEMA_DIR if set). The
|
|
10
10
|
# default provider is keyless 'random'; pass --provider llm for LLM-realistic
|
|
11
|
-
# values
|
|
12
|
-
#
|
|
11
|
+
# values. The LLM vendor/model arrive as $G3DT_LLM_PROVIDER / $G3DT_LLM_MODEL
|
|
12
|
+
# (resolved by g3dt: CLI flags > SSM app/llm_* > default) and are forwarded to
|
|
13
|
+
# the simulator as flags; the API key file path arrives as $LLM_API_KEY_FILE.
|
|
14
|
+
# The old ~/.g3dt/.env is no longer read.
|
|
13
15
|
|
|
14
16
|
set -euo pipefail
|
|
15
17
|
|
|
16
|
-
# LLM provider config file (lives outside the installed package).
|
|
17
|
-
ENV_FILE="${G3DT_ENV_FILE:-$HOME/.g3dt/.env}"
|
|
18
|
-
|
|
19
18
|
usage() {
|
|
20
19
|
cat <<EOF
|
|
21
20
|
Usage: $(basename "$0") --schema <path> --version <ver> [options]
|
|
@@ -32,8 +31,8 @@ Options:
|
|
|
32
31
|
--num-records N|n1,n2 Records per study: one number for all, or a comma list
|
|
33
32
|
(one per study). Default: ${DEFAULT_NUM_RECORDS}
|
|
34
33
|
--provider random|llm Value strategy. Default: ${DEFAULT_PROVIDER}
|
|
35
|
-
'random' needs no key; 'llm'
|
|
36
|
-
|
|
34
|
+
'random' needs no key; 'llm' uses \$G3DT_LLM_PROVIDER /
|
|
35
|
+
\$G3DT_LLM_MODEL / \$LLM_API_KEY_FILE (set by g3dt).
|
|
37
36
|
--seed N RNG seed for reproducible output.
|
|
38
37
|
--output-root DIR Root output dir. Default: ${DEFAULT_OUTPUT_ROOT}
|
|
39
38
|
-h, --help Show this help and exit.
|
|
@@ -123,9 +122,16 @@ for i in "${!STUDY_ARRAY[@]}"; do
|
|
|
123
122
|
--num-records "$N"
|
|
124
123
|
--provider "$PROVIDER")
|
|
125
124
|
[[ -n "$SEED" ]] && CMD+=(--seed "$SEED")
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
if [[ "$PROVIDER" == "llm" ]]; then
|
|
126
|
+
# Vendor/model resolved by g3dt (flags > SSM > default) and forwarded
|
|
127
|
+
# as simulator flags, because the simulator's own precedence puts
|
|
128
|
+
# flags above any .env or environment variable.
|
|
129
|
+
[[ -n "${G3DT_LLM_PROVIDER:-}" ]] && CMD+=(--llm-provider "$G3DT_LLM_PROVIDER")
|
|
130
|
+
[[ -n "${G3DT_LLM_MODEL:-}" ]] && CMD+=(--llm-model "$G3DT_LLM_MODEL")
|
|
131
|
+
# Neutralize any .env in the caller's CWD: /dev/null exists (satisfies
|
|
132
|
+
# the simulator's exists=True check) and dotenv-parses to empty, so
|
|
133
|
+
# only the flags above and the inherited $LLM_API_KEY_FILE apply.
|
|
134
|
+
CMD+=(--env-file /dev/null)
|
|
129
135
|
fi
|
|
130
136
|
"${CMD[@]}"
|
|
131
137
|
done
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"""`g3dt k8s` — restart Gen3 microservices / ETL via ArgoCD (LOCAL only).
|
|
2
|
-
|
|
3
|
-
These use ``argocd login --sso`` (a browser flow), so they cannot run headless
|
|
4
|
-
on EC2. The wrapped scripts receive their settings as ``G3DT_*`` environment
|
|
5
|
-
variables resolved from SSM — they read no config files.
|
|
6
|
-
"""
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
|
|
9
|
-
import typer
|
|
10
|
-
|
|
11
|
-
from g3dt.config import script_env
|
|
12
|
-
from g3dt.cli._internal import runner
|
|
13
|
-
from g3dt.cli._internal.resolve import env_of
|
|
14
|
-
|
|
15
|
-
app = typer.Typer(no_args_is_help=True, help="ArgoCD / Kubernetes restarts (local).")
|
|
16
|
-
|
|
17
|
-
_SCHEMA = "services/k8s_ops/argocd_restart_schema.sh"
|
|
18
|
-
_ETL = "services/k8s_ops/argocd_restart_etl.sh"
|
|
19
|
-
_ETL_AND_MS = "services/k8s_ops/restart_etl_and_ms.sh"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@app.command(name="restart-schema")
|
|
23
|
-
def restart_schema(
|
|
24
|
-
env: str = typer.Option(..., "--env", "-e", help="Environment, e.g. test."),
|
|
25
|
-
sync: bool = typer.Option(False, "--sync", "-s", help="argocd app sync first."),
|
|
26
|
-
) -> None:
|
|
27
|
-
"""Restart sheepdog/peregrine/guppy/portal (schema microservices)."""
|
|
28
|
-
e = env_of(env)
|
|
29
|
-
args = ["-d", e.domain, "-a", e.app_name, "-n", e.namespace]
|
|
30
|
-
if sync:
|
|
31
|
-
args.append("-s")
|
|
32
|
-
runner.run(runner.bash_script(_SCHEMA, *args), env=script_env(e))
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@app.command(name="restart-etl")
|
|
36
|
-
def restart_etl(
|
|
37
|
-
env: str = typer.Option(..., "--env", "-e", help="Environment, e.g. test."),
|
|
38
|
-
sync: bool = typer.Option(False, "--sync", "-s", help="argocd app sync first."),
|
|
39
|
-
) -> None:
|
|
40
|
-
"""Create + run the ETL cronjob and wait for completion."""
|
|
41
|
-
e = env_of(env)
|
|
42
|
-
args = ["-e", env]
|
|
43
|
-
if sync:
|
|
44
|
-
args.append("-s")
|
|
45
|
-
runner.run(runner.bash_script(_ETL, *args), env=script_env(e))
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
@app.command(name="restart-ms")
|
|
49
|
-
def restart_ms(
|
|
50
|
-
env: str = typer.Option(..., "--env", "-e", help="Environment, e.g. test."),
|
|
51
|
-
) -> None:
|
|
52
|
-
"""Restart both ETL and schema microservices (wraps restart_etl_and_ms.sh)."""
|
|
53
|
-
e = env_of(env)
|
|
54
|
-
runner.run(runner.bash_script(_ETL_AND_MS, env), env=script_env(e))
|
|
File without changes
|
|
File without changes
|
{gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/_internal/__init__.py
RENAMED
|
File without changes
|
{gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/_internal/dispatch.py
RENAMED
|
File without changes
|
{gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/cli/_internal/registry.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/indexd/indexd_registrar.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/dictionary/deploy_dd.sh
RENAMED
|
File without changes
|
{gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/dictionary/pull_dict.sh
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/services/k8s_ops/login_to_pod.sh
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/upload/metadata_deleter.py
RENAMED
|
File without changes
|
{gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/upload/metadata_submitter.py
RENAMED
|
File without changes
|
{gen3_dataops_toolkit-3.3.0 → gen3_dataops_toolkit-3.5.0}/src/g3dt/upload/upload_synthdata_s3.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|