backend.actions

class backend.actions.Action(opts, action, log=None)[source]

Object to send data back to fronted

Parameters:
  • frontent_callback (backend.callback.FrontendCallback) – object to post data back to frontend
  • destdir – filepath with build results
  • action (dict) – dict-like object with action task

Expected action keys:

  • action_type: main field determining what action to apply

# TODO: describe actions

get_chroot_result_dir(chroot, project_dirname, ownername)[source]
handle_createrepo()[source]
handle_fork(result)[source]
handle_delete_project(result)[source]
handle_comps_update(result)[source]
_handle_delete_builds(ownername, projectname, project_dirname, chroot_builddirs, build_ids)[source]

call /bin/copr-repo –delete

handle_delete_build()[source]
handle_delete_multiple_builds()[source]
handle_delete_chroot()[source]
handle_generate_gpg_key(result)[source]
generate_gpg_key(ownername, projectname)[source]
handle_rawhide_to_release()[source]
handle_cancel_build(result)[source]
handle_build_module()[source]
run()[source]

Handle action (other then builds) - like rename or delete of project

class backend.actions.ActionType[source]
DELETE = 0
RENAME = 1
LEGAL_FLAG = 2
CREATEREPO = 3
UPDATE_COMPS = 4
GEN_GPG_KEY = 5
RAWHIDE_TO_RELEASE = 6
FORK = 7
UPDATE_MODULE_MD = 8
BUILD_MODULE = 9
CANCEL_BUILD = 10
class backend.actions.ActionResult[source]
WAITING = 0
SUCCESS = 1
FAILURE = 2
class backend.actions.ActionQueueTask(id)[source]
class backend.actions.ActionWorkerManager(redis_connection=None, max_workers=8, log=None)[source]
frontend_client = None
worker_prefix = 'action_worker'
start_task(worker_id, task)[source]

Start background job using the ‘task’ object taken from the ‘tasks’ queue. The background task should _on its own_ and ASAP let the manager know that it successfully started (e.g. mark the job ‘started’ in redis DB), so the has_worker_started() method later gives us valid info.

has_worker_ended(worker_id, task_info)[source]

Check ‘task_info’ (dictionary output from redis) whether the task is already finished by worker. If yes, do whatever is needed with the result (contact frontend) and return True. If the task is still processed, return False.

finish_task(worker_id, task_info)[source]

This is called once the worker manager consider the task to be done, because the has_worker_ended() method already returns True. Override this function and use it to let Frontend know that the task finished, and how (whether it succeeded, etc.).

is_worker_alive(worker_id, task_info)[source]

Check staled jobs on background, whether they haven’t died before they notified us about the status. We’ll keep asking after worker_timeout_deadcheck seconds left since we tried to spawn the worker.