def run(name, interactive, profile, data): if not data or not Path(data).exists(): data = None else: data = Path(data) try: config = get_model_configuration(name, profile=profile) except ApiException as e: click.secho("{}".format(e.reason)) exit(0) click.clear() if "ModelConfigurationSetup" in config.type: resource = get_setup(name, profile=profile) elif "ModelConfiguration" in config.type or "DataTransformation": resource = get_model_configuration(name, profile=profile) try: show_model_configuration_details(resource) except AttributeError as e: click.secho("Unable to run it: {}".format(str(e)), fg="red") exit(1) try: verify_input_parameters(resource, interactive, data, profile) except ValueError as e: click.secho("Unable to run. Please use interactive mode", fg="yellow") exit(1) try: if interactive and click.confirm( "Do you want to edit the parameters?"): edit_parameters(resource, interactive) except ValueError as e: click.secho("Unable to run. Please use interactive mode", fg="yellow") exit(1) run_method_setup(resource, interactive, data)
def test_print_table_list(): model_configurations = [ get_model_configuration(CONFIG_PARTIAL_INFO, profile=testing) ] setups = [ get_setup(obtain_id(SETUP_PARTIAL_INFO), profile=testing), get_setup(SETUP_FULL_INFO, profile=testing) ] print_table_list(setups) print_table_list(model_configurations)
def model_configuration_show(name, profile): try: _setup = get_model_configuration(name, profile=profile) except ApiException as e: click.secho("{}".format(e.reason)) exit(1) try: show_model_configuration_details(_setup) except AttributeError as e: click.secho("This setup is not executable.\n".format(e), fg="red") exit(1)
def test_print_data_property_table(): setups = [ get_setup(obtain_id(SETUP_PARTIAL_INFO), profile=testing), get_setup(SETUP_FULL_INFO, profile=testing) ] model_configurations = [ get_model_configuration(CONFIG_PARTIAL_INFO, profile=testing) ] for setup in setups: print_data_property_table(setup) for model_configuration in model_configurations: print_data_property_table(model_configuration)
def transformation_run(data_transformation_id, profile): """ You must pass the argument ID (ID of the transformation) For example: dame transformation run topoflow_climate """ resource = get_model_configuration(data_transformation_id, profile=profile) interactive = True data = Path('.') try: show_model_configuration_details(resource) except AttributeError as e: click.secho("This setup is not executable.\n".format(e), fg="red") run_method_setup(resource, interactive, data)
def test_show_model_configuration_details(): model_configurations = [ get_model_configuration(CONFIG_PARTIAL_INFO, profile=testing) ] setups = [ get_setup(obtain_id(SETUP_PARTIAL_INFO), profile=testing), get_setup(SETUP_FULL_INFO, profile=testing) ] for setup in setups: try: show_model_configuration_details(setup) except AttributeError: pass for model_configuration in model_configurations: try: show_model_configuration_details(model_configuration) except AttributeError: pass