Ejemplo n.º 1
0
def delete_perf_job(context, storage_id):
    # Delete it from scheduler
    filters = {'storage_id': storage_id}
    tasks = db.task_get_all(context, filters=filters)
    failed_tasks = db.failed_task_get_all(context, filters=filters)
    for task in tasks:
        metrics_rpcapi.TaskAPI().remove_job(context, task.get('id'),
                                            task.get('executor'))
    for failed_task in failed_tasks:
        metrics_rpcapi.TaskAPI().remove_failed_job(context,
                                                   failed_task.get('id'),
                                                   failed_task.get('executor'))

    # Soft delete tasks
    db.task_delete_by_storage(context, storage_id)
    db.failed_task_delete_by_storage(context, storage_id)
 def __init__(self, ctx, task_id, storage_id, args, interval, executor):
     self.ctx = ctx
     self.task_id = task_id
     self.storage_id = storage_id
     self.args = args
     self.interval = interval
     self.metric_task_rpcapi = metrics_task_rpcapi.TaskAPI()
     self.driver_api = driverapi.API()
     self.executor = executor
     self.scheduler = schedule_manager.SchedulerManager().get_scheduler()
 def __init__(self, ctx, failed_task_id, storage_id, args, job_id,
              retry_count, start_time, end_time, executor):
     self.ctx = ctx
     self.failed_task_id = failed_task_id
     self.retry_count = retry_count
     self.storage_id = storage_id
     self.job_id = job_id
     self.args = args
     self.start_time = start_time
     self.end_time = end_time
     self.metrics_task_rpcapi = metrics_task_rpcapi.TaskAPI()
     self.scheduler_instance = \
         schedule_manager.SchedulerManager().get_scheduler()
     self.result = TelemetryJobStatus.FAILED_JOB_STATUS_INIT
     self.executor = executor
Ejemplo n.º 4
0
def create_perf_job(context, storage_id, capabilities):
    # Add it to db
    # Check resource_metric attribute availability and
    # check if resource_metric is empty
    if 'resource_metrics' not in capabilities \
            or not bool(capabilities.get('resource_metrics')):
        raise exception.EmptyResourceMetrics()

    task = dict()
    task.update(storage_id=storage_id)
    task.update(args=capabilities.get('resource_metrics'))
    task.update(interval=CONF.telemetry.performance_collection_interval)
    task.update(method=constants.TelemetryCollection.PERFORMANCE_TASK_METHOD)
    db.task_create(context=context, values=task)
    # Add it to RabbitMQ
    filters = {'storage_id': storage_id}
    task_id = db.task_get_all(context, filters=filters)[0].get('id')
    metrics_rpcapi.TaskAPI().create_perf_job(context, task_id)
Ejemplo n.º 5
0
 def __init__(self, ctx):
     self.ctx = ctx
     self.task_rpcapi = task_rpcapi.TaskAPI()