feat!: allows new seed spec instead of cli arg, removes old cli arg
All checks were successful
gitea-physics/deepdog/pipeline/head This commit looks good

This commit is contained in:
Deepak Mallubhotla 2024-04-28 20:54:58 -05:00
parent 2105754911
commit 7108dd0111
Signed by: deepak
GPG Key ID: BEBAEBF28083E022
2 changed files with 7 additions and 15 deletions

View File

@ -30,18 +30,6 @@ def parse_args() -> argparse.Namespace:
help="A json file with the indexify config for parsing job indexes. Will skip if not present",
default="",
)
parser.add_argument(
"--seed-index",
type=int,
help='take an integer to append as a "seed" key with range at end of indexify dict. Skip if <= 0',
default=0,
)
parser.add_argument(
"--seed-fieldname",
type=str,
help='if --seed-index is set, the fieldname to append to the indexifier. "seed" by default',
default="seed",
)
parser.add_argument(
"--coalesced-keys",
type=str,

View File

@ -51,9 +51,13 @@ def main(args: argparse.Namespace):
indexifier = None
if args.indexify_json:
with open(args.indexify_json, "r") as indexify_json_file:
indexify_data = json.load(indexify_json_file)
if args.seed_index > 0:
indexify_data[args.seed_fieldname] = list(range(args.seed_index))
indexify_spec = json.load(indexify_json_file)
indexify_data = indexify_spec["indexes"]
if "seed_spec" in indexify_spec:
seed_spec = indexify_spec["seed_spec"]
indexify_data[seed_spec["field_name"]] = list(
range(seed_spec["num_seeds"])
)
# _logger.debug(f"Indexifier data looks like {indexify_data}")
indexifier = deepdog.indexify.Indexifier(indexify_data)