def __init__(self, task=None, fake=False, **attributes): """Task object init :param task: dictionary like object, that represents a task :param fake: if True, will be created task object with random UUID and parameters, passed in 'attributes'. Does not create database record. Used for special purposes, like task config validation. """ self.fake = fake if fake: self.task = task or {"uuid": str(uuid.uuid4())} self.task.update(attributes) else: self.task = task or db.task_create(attributes)
def _create_task(self, values=None): values = values or {} if 'deployment_uuid' not in values: values['deployment_uuid'] = self.deploy['uuid'] return db.task_create(values)
def _create_task(self, values=None): values = values or {} if "deployment_uuid" not in values: values["deployment_uuid"] = self.deploy["uuid"] return db.task_create(values)
def __init__(self, task=None, **attributes): if task: self.task = task else: self.task = db.task_create(attributes)
def _create_task(self, values=None): return db.task_create(values or {})