def get_job_config(job_spec, config_file, options): try: job_key = AuroraJobKey.from_path(job_spec) select_cluster = job_key.cluster select_env = job_key.env select_role = job_key.role jobname = job_key.name except AuroraJobKey.Error: deprecation_warning('Please refer to your job in CLUSTER/ROLE/ENV/NAME format.') select_cluster = options.cluster if options.cluster else None select_env = options.env select_role = None jobname = job_spec try: json_option = options.json except AttributeError: json_option = False try: bindings = options.bindings except AttributeError: bindings = () return get_config( jobname, config_file, json_option, bindings, select_cluster=select_cluster, select_role=select_role, select_env=select_env)
def _disambiguate_or_die(cls, client, role, env, name): # Returns a single AuroraJobKey if one can be found given the args, potentially # querying the scheduler. Calls die() with an appropriate error message otherwise. try: disambiguator = cls(client, role, env, name) except ValueError as e: die(e) if not disambiguator.ambiguous: return AuroraJobKey(client.cluster.name, role, env, name) deprecation_warning("Job ambiguously specified - querying the scheduler to disambiguate") matches = disambiguator.query_matches() if len(matches) == 1: (match,) = matches log.info("Found job %s" % match) return match elif len(matches) == 0: die("No jobs found") else: die("Multiple jobs match (%s) - disambiguate by using the CLUSTER/ROLE/ENV/NAME form" % ",".join(str(m) for m in matches))
def _disambiguate_or_die(cls, client, role, env, name): # Returns a single AuroraJobKey if one can be found given the args, potentially # querying the scheduler. Calls die() with an appropriate error message otherwise. try: disambiguator = cls(client, role, env, name) except ValueError as e: die(e) if not disambiguator.ambiguous: return AuroraJobKey(client.cluster.name, role, env, name) deprecation_warning( "Job ambiguously specified - querying the scheduler to disambiguate" ) matches = disambiguator.query_matches() if len(matches) == 1: (match, ) = matches log.info("Found job %s" % match) return match elif len(matches) == 0: die("No jobs found") else: die("Multiple jobs match (%s) - disambiguate by using the CLUSTER/ROLE/ENV/NAME form" % ",".join(str(m) for m in matches))
def _warn_on_deprecated_health_check_interval_secs(config): if config.raw().health_check_interval_secs() is not Empty: deprecation_warning(HEALTH_CHECK_INTERVAL_SECS_DEPRECATION_WARNING)
def _warn_on_deprecated_daemon_job(config): if config.raw().daemon() is not Empty: deprecation_warning(DAEMON_DEPRECATION_WARNING)
def _warn_on_deprecated_cron_policy(config): if config.raw().cron_policy() is not Empty: deprecation_warning(CRON_DEPRECATION_WARNING)
def _warn_on_appapp_layouts(config): if config.raw().has_layout(): deprecation_warning(APPAPP_DEPRECATION_WARNING)