예제 #1
0
def RunDeployCloudScheduler(args):
  """Perform a deployment using Cloud Scheduler APIs based on the given args.

  Args:
    args: argparse.Namespace, An object that contains the values for the
        arguments specified in the ArgsDeploy() function.

  Returns:
    A list of config file identifiers, see yaml_parsing.ConfigYamlInfo.
  """
  configs = _GetDeployableConfigsFromArgs(args)
  if configs:
    # TODO(b/169069379): Confirm the same metric name can be used twice in the
    # same run.
    metrics.CustomTimedEvent(metric_names.UPDATE_CONFIG_START)
    # TODO(b/169069379): Upgrade to use GA once the relevant code is promoted
    scheduler_api = scheduler.GetApiAdapter(base.ReleaseTrack.ALPHA,
                                            legacy_cron=True)
    jobs_data = app_deploy_migration_util.FetchCurrentJobsData(scheduler_api)
    for config in configs:
      app_deploy_migration_util.ValidateCronYamlFileConfig(config)
      app_deploy_migration_util.DeployCronYamlFile(
          scheduler_api, config, jobs_data)
    metrics.CustomTimedEvent(metric_names.UPDATE_CONFIG)
  return [c.name for c in configs]
def RunDeployCloudScheduler(config):
    """Perform a deployment using Cloud Scheduler APIs based on the given args.

  Args:
    config: A yaml_parsing.ConfigYamlInfo object for the parsed YAML file we are
      going to process.

  Returns:
    A list of config file identifiers, see yaml_parsing.ConfigYamlInfo.
  """
    # TODO(b/169069379): Upgrade to use GA once the relevant code is promoted
    scheduler_api = scheduler.GetApiAdapter(base.ReleaseTrack.BETA,
                                            legacy_cron=True)
    jobs_data = app_deploy_migration_util.FetchCurrentJobsData(scheduler_api)
    app_deploy_migration_util.ValidateCronYamlFileConfig(config)
    app_deploy_migration_util.DeployCronYamlFile(scheduler_api, config,
                                                 jobs_data)