Skip to content

Commit

Permalink
put local test run in separate function
Browse files Browse the repository at this point in the history
  • Loading branch information
jblom committed Nov 2, 2023
1 parent 083bf11 commit b968744
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@
logger = logging.getLogger()


# triggered by running: python worker.py --run-test-file
def process_configured_input_file():
logger.info("Triggered processing of configured VISXP_PREP.TEST_INPUT_PATH")
proc_result = generate_input_for_feature_extraction(cfg.VISXP_PREP.TEST_INPUT_FILE)
if proc_result.provenance:
logger.info(
f"Successfully processed example file in {proc_result.provenance.processing_time_ms}ms"
)
logger.info("Result ok, now applying the desired IO on the results")
validated_output: CallbackResponse = apply_desired_io_on_output(
cfg.VISXP_PREP.TEST_INPUT_FILE,
proc_result,
cfg.INPUT.DELETE_ON_COMPLETION,
cfg.OUTPUT.DELETE_ON_COMPLETION,
cfg.OUTPUT.TRANSFER_ON_COMPLETION,
)
else:
logger.info(f"Error: {proc_result.state}: {proc_result.message}")


class VideoSegmentationWorker(base_worker):
def __init__(self, config):
logger.info(config)
Expand Down Expand Up @@ -229,23 +249,7 @@ def save_to_dane_index(
if args.run_test_file != "n":
logger.info("Running main_data_processor with VISXP_PREP.TEST_INPUT_FILE ")
if cfg.VISXP_PREP and cfg.VISXP_PREP.TEST_INPUT_FILE:
proc_result = generate_input_for_feature_extraction(
cfg.VISXP_PREP.TEST_INPUT_FILE
)
if proc_result.provenance:
logger.info(
f"Successfully processed example file in {proc_result.provenance.processing_time_ms}ms"
)
logger.info("Result ok, now applying the desired IO on the results")
validated_output: CallbackResponse = apply_desired_io_on_output(
cfg.VISXP_PREP.TEST_INPUT_FILE,
proc_result,
cfg.INPUT.DELETE_ON_COMPLETION,
cfg.OUTPUT.DELETE_ON_COMPLETION,
cfg.OUTPUT.TRANSFER_ON_COMPLETION,
)
else:
logger.info(f"Error: {proc_result.state}: {proc_result.message}")
process_configured_input_file()
else:
logger.error("Please configure an input file in VISXP_PREP.TEST_INPUT_FILE")
sys.exit()
Expand Down

0 comments on commit b968744

Please sign in to comment.