Skip to content

Commit

Permalink
add options to skip or run sinlge steps in a schema
Browse files Browse the repository at this point in the history
  • Loading branch information
thanodnl committed Dec 13, 2023
1 parent 8442564 commit 67ae09c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion citus_load/citus_load
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ Usage:
citus_load repo add <repo>
citus_load schema list [-m | --machine]
citus_load schema list-params <schema> [-m | --machine]
citus_load [load] <schema> [<key=value> ...]
citus_load [load] <schema> [<key=value> ...] [--skip=<step> ...] [--only=<step> ...]
citus_load (-h | --help)
citus_load --version
Options:
-h --help Show this screen.
--version Show version.
-m --machine Output suitable for easier processing (eg. autocomplete).
--skip=<step> Skip the specified steps.
--only=<step> Only run the specified steps.
"""
from docopt import docopt
Expand Down Expand Up @@ -268,11 +270,29 @@ def load(arguments):

print(f"parameters: {parameters}")

skip = arguments["--skip"]
only = arguments["--only"]

for step in schema.steps():
if skip and name_has_substr_in_list(step.name, skip):
print(f"skipping step: {step.name}")
continue

if only and name_has_substr_in_list(step.name, skip):
print(f"skipping step: {step.name}")
continue

print(f"running step: {step.name}")
step.run(parameters)


def name_has_substr_in_list(name, l):
for item in l:
if item in name:
return True
return False


def parse_load_parameters(arguments):
kv_params = arguments["<key=value>"]
parameters = {}
Expand Down

0 comments on commit 67ae09c

Please sign in to comment.