Show More
@@ -5485,8 +5485,7 b' class ScheduleEntry(Base, BaseModel):' | |||||
5485 | @schedule_type.setter |
|
5485 | @schedule_type.setter | |
5486 | def schedule_type(self, val): |
|
5486 | def schedule_type(self, val): | |
5487 | if val not in self.schedule_types: |
|
5487 | if val not in self.schedule_types: | |
5488 |
raise ValueError('Value must be on of `{}` and got `{}`' |
|
5488 | raise ValueError(f'Value must be on of `{val}` and got `{self.schedule_type}`') | |
5489 | val, self.schedule_type)) |
|
|||
5490 |
|
5489 | |||
5491 | self._schedule_type = val |
|
5490 | self._schedule_type = val | |
5492 |
|
5491 | |||
@@ -5494,21 +5493,25 b' class ScheduleEntry(Base, BaseModel):' | |||||
5494 | def get_uid(cls, obj): |
|
5493 | def get_uid(cls, obj): | |
5495 | args = obj.task_args |
|
5494 | args = obj.task_args | |
5496 | kwargs = obj.task_kwargs |
|
5495 | kwargs = obj.task_kwargs | |
|
5496 | ||||
5497 | if isinstance(args, JsonRaw): |
|
5497 | if isinstance(args, JsonRaw): | |
5498 | try: |
|
5498 | try: | |
5499 | args = json.loads(args) |
|
5499 | args = json.loads(str(args)) | |
5500 | except ValueError: |
|
5500 | except ValueError: | |
|
5501 | log.exception('json.loads of args failed...') | |||
5501 | args = tuple() |
|
5502 | args = tuple() | |
5502 |
|
5503 | |||
5503 | if isinstance(kwargs, JsonRaw): |
|
5504 | if isinstance(kwargs, JsonRaw): | |
5504 | try: |
|
5505 | try: | |
5505 | kwargs = json.loads(kwargs) |
|
5506 | kwargs = json.loads(str(kwargs)) | |
5506 | except ValueError: |
|
5507 | except ValueError: | |
|
5508 | log.exception('json.loads of kwargs failed...') | |||
5507 | kwargs = dict() |
|
5509 | kwargs = dict() | |
5508 |
|
5510 | |||
5509 | dot_notation = obj.task_dot_notation |
|
5511 | dot_notation = obj.task_dot_notation | |
5510 | val = '.'.join(map(safe_str, [ |
|
5512 | val = '.'.join(map(safe_str, [dot_notation, args, sorted(kwargs.items())])) | |
5511 | sorted(dot_notation), args, sorted(kwargs.items())])) |
|
5513 | log.debug('calculating task uid using id:`%s`', val) | |
|
5514 | ||||
5512 | return sha1(safe_bytes(val)) |
|
5515 | return sha1(safe_bytes(val)) | |
5513 |
|
5516 | |||
5514 | @classmethod |
|
5517 | @classmethod | |
@@ -5519,6 +5522,10 b' class ScheduleEntry(Base, BaseModel):' | |||||
5519 | def get_by_schedule_id(cls, schedule_id): |
|
5522 | def get_by_schedule_id(cls, schedule_id): | |
5520 | return cls.query().filter(cls.schedule_entry_id == schedule_id).scalar() |
|
5523 | return cls.query().filter(cls.schedule_entry_id == schedule_id).scalar() | |
5521 |
|
5524 | |||
|
5525 | @classmethod | |||
|
5526 | def get_by_task_uid(cls, task_uid): | |||
|
5527 | return cls.query().filter(cls.task_uid == task_uid).scalar() | |||
|
5528 | ||||
5522 | @property |
|
5529 | @property | |
5523 | def task(self): |
|
5530 | def task(self): | |
5524 | return self.task_dot_notation |
|
5531 | return self.task_dot_notation |
General Comments 0
You need to be logged in to leave comments.
Login now