Esempio n. 1
0
def service_exists(ctx, service_name):
    """
    Check ecs service with SERVICE_NAME is already exists.
    """
    ConfigHelper.init(ctx)
    if Service(service_name, config=ConfigHelper.get_config()).exists():
        LoggingHelper.print_info_n_exit(
            "service {} is already exists.".format(service_name), 0)
    else:
        LoggingHelper.print_info_n_exit(
            "service {} is not exists.".format(service_name), 1)
Esempio n. 2
0
def batch_task(ctx, service_name, task_family, command, wait):
    """
    Run one-off task with COMMAND on service helper tasks FAMILY_NAME.
    """
    ConfigHelper.init(ctx)
    config = ConfigHelper.get_helper_tasks(service_name, task_family)
    cluster_name = ConfigHelper.get_cluster_name(service_name)
    batch = BatchTask(yml=config)
    LoggingHelper.print_info(batch.get_task_def_diff())
    batch.createOrUpdate()
    batch.run(command=command, cluster_name=cluster_name, wait=wait)
Esempio n. 3
0
def cron_sync(ctx, cron_name):
    """
    Create / update cron jobs list with cloudwatch event with CRON_NAME.
    """
    ConfigHelper.init(ctx)
    cron_config = ConfigHelper.get_cronjobs_config(cron_name)
    help_tasks_config = ConfigHelper.get_helper_tasks(cron_name)
    cluster_name = ConfigHelper.get_cluster_name(cron_name)
    CrontabJobs(cluster_name=cluster_name,
                yml_cron=cron_config,
                yml_help_tasks=help_tasks_config).sync()
Esempio n. 4
0
def service_stable(ctx, service_name):
    """
    Wait until ecs service SERVICE_NAME is stable.
    """
    ConfigHelper.init(ctx)
    if Service(service_name,
               config=ConfigHelper.get_config()).wait_until_stable():
        LoggingHelper.print_info_n_exit(
            "service {} is stable.".format(service_name), 0)
    else:
        LoggingHelper.print_info_n_exit(
            "service {} is not stable.".format(service_name), 1)
Esempio n. 5
0
def service_exists(ctx, service_name):
    """
    Check ecs service with SERVICE_NAME is already exists.
    """
    ConfigHelper.init(ctx)
    cluster_name = ConfigHelper.get_cluster_name(service_name)
    if EcsHelper.service_exists(cluster_name, service_name):
        LoggingHelper.print_info_n_exit(
            "service {} is already exists.".format(service_name), 0)
    else:
        LoggingHelper.print_info_n_exit(
            "service {} is not exists.".format(service_name), 1)