Skip to content

Commit

Permalink
step
Browse files Browse the repository at this point in the history
  • Loading branch information
jldupont committed Jul 21, 2024
1 parent 74800a4 commit fdf85fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ The files generated are uploaded to a specified Google Cloud Storage bucket.

Organization in the GCS bucket is as follows:

{PROJECT_ID}/{TIMESTAMP}_config.json
{PROJECT_ID}/{SERVICE_CLASS}/{TIMESTAMP}_inventory.json
{PROJECT_ID}/{TIMESTAMP}/config.json
{PROJECT_ID}/{TIMESTAMP}/{SERVICE_CLASS}.json

The `TIMESTAMP` is obtained at the start of the inventory (aka snapshot) process. Thus, all files prefixed with the same `TIMESTAMP` are issued from the same execution of the Cloud Run Job `gcp-inventory`.

Expand Down
16 changes: 6 additions & 10 deletions src/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ def store_spec_list(config: Config,
ts: str,
service_class_name: str,
specs: List[Spec]):
"""
gs://bucket/{SERVICE_CLASS}/{TIMESTAMP}_inventory.json
"""
base_path = f"{config.ProjectId}/{service_class_name}"
path = f"{TEMPDIR}/{base_path}/{ts}_inventory.json"

base_path = f"{config.ProjectId}/{ts}"
path = f"{TEMPDIR}/{base_path}/{service_class_name}.json"
liste: str = spec_list_to_json(specs)

mkdir(f"{TEMPDIR}/{base_path}")
Expand All @@ -45,11 +43,9 @@ def store_spec_list(config: Config,


def store_config(config: Config, ts: str):
"""
gs://bucket/{TIMESTAMP}_config.json
"""
base_path = f"{config.ProjectId}"
path = f"{TEMPDIR}/{base_path}/{ts}_config.json"

base_path = f"{config.ProjectId}/{ts}"
path = f"{TEMPDIR}/{base_path}/config.json"
obj_str: str = config.to_json()

mkdir(f"{TEMPDIR}/{base_path}")
Expand Down

0 comments on commit fdf85fb

Please sign in to comment.