How to use the kobo.hub.decorators.validate_worker function in kobo

To help you get started, we’ve selected a few kobo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github release-engineering / kobo / kobo / hub / xmlrpc / worker.py View on Github external
@validate_worker
def get_worker_tasks(request):
    """
    Get list of tasks running on a worker.

    @rtype: list
    """
    task_list = []
    for task in request.worker.running_tasks().order_by("-exclusive", "-awaited", "id"):
        task_info = task.export()

        # set wakeup alert
        if task.waiting:
            finished, unfinished = task.check_wait()
            if len(finished) > 0:
                task_info["alert"] = True
github release-engineering / kobo / kobo / hub / xmlrpc / worker.py View on Github external
@validate_worker
def check_wait(request, task_id, child_list=None):
    task = Task.objects.get(id=task_id)
    return task.check_wait(child_list)
github release-engineering / kobo / kobo / hub / xmlrpc / worker.py View on Github external
@validate_worker
def get_task_no_verify(request, task_id):
    """
    Get information about a task, do not verify whether is assigned to a worker.

    @param task_id: a task ID
    @type  task_id: int
    @rtype: dict
    """
    task = Task.objects.get(id=task_id)
    return task.export()
github release-engineering / kobo / kobo / hub / xmlrpc / worker.py View on Github external
@validate_worker
def update_worker(request, enabled, ready, task_count):
    return request.worker.update_worker(enabled, ready, task_count)
github release-engineering / kobo / kobo / hub / xmlrpc / worker.py View on Github external
@validate_worker
def upload_task_log(request, task_id, relative_path, mode, chunk_start, chunk_len, chunk_checksum, encoded_chunk):
    """
    Upload a task log.

    @param task_id: task ID
    @type  task_id: int
    @param relative_path: relative path (under task_dir) to the log file
    @type  relative_path: str
    @param mode: file perms (example: 0644)
    @type  mode: int
    @param chunk_start: chunk start position in the file (-1 for append)
    @type  chunk_start: str
    @param chunk_len: chunk length
    @type  chunk_len: str
    @param chunk_checksum: sha256 checksum (lower case)
    @type  chunk_checksum: str
github release-engineering / kobo / kobo / hub / xmlrpc / worker.py View on Github external
@validate_worker
def close_task(request, task_id, task_result):
    task = Task.objects.get_and_verify(task_id=task_id, worker=request.worker)
    return task.close_task(task_result=task_result)
github release-engineering / kobo / kobo / hub / xmlrpc / worker.py View on Github external
@validate_worker
def set_task_weight(request, task_id, weight):
    task = Task.objects.get_and_verify(task_id=task_id, worker=request.worker)
    task.setWeight(weight)
    return task.weight
github release-engineering / kobo / kobo / hub / xmlrpc / worker.py View on Github external
@validate_worker
def cancel_task(request, task_id):
    task = Task.objects.get_and_verify(task_id=task_id, worker=request.worker)
    return task.cancel_task()
github release-engineering / kobo / kobo / hub / xmlrpc / worker.py View on Github external
@validate_worker
def fail_task(request, task_id, task_result):
    task = Task.objects.get_and_verify(task_id=task_id, worker=request.worker)
    return task.fail_task(task_result=task_result)
github release-engineering / kobo / kobo / hub / xmlrpc / worker.py View on Github external
@validate_worker
def get_task(request, task_id):
    """
    Get information about a task.

    @param task_id: a task ID
    @type  task_id: int
    @rtype: dict
    """
    task = Task.objects.get_and_verify(task_id=task_id, worker=request.worker)
    return task.export()