def stop_job()

in cli/src/klio_cli/cli.py [0:0]


def stop_job(klio_config, config_meta, job_name, region, gcp_project):
    if job_name and any([config_meta.job_dir, config_meta.config_file]):
        logging.error(
            "'--job-name' can not be used with '--config-file' and/or "
            "'--job-dir'."
        )
        raise SystemExit(1)

    if job_name and not all([gcp_project, region]):
        logging.error(
            "Both '--region' and '--gcp-project' are required when using the "
            "'--job-name' option."
        )
        raise SystemExit(1)

    if not job_name:
        job_name = klio_config.job_name
        gcp_project = klio_config.pipeline_options.project
        region = klio_config.pipeline_options.region

    # TODO: make this a click option once draining is supported @lynn
    strategy = "cancel"
    if klio_config.pipeline_options.runner == var.KlioRunner.DIRECT_GKE_RUNNER:
        gke_commands = cli_utils.import_gke_commands()

        gke_commands.StopPipelineGKE(config_meta.job_dir).stop()
    else:
        job_commands.stop.StopJob().stop(
            job_name, gcp_project, region, strategy
        )