MCPcopy Create free account
hub / github.com/closeio/tasktiger / move_task

Method move_task

tasktiger/redis_scripts.py:605–663  ·  view source on GitHub ↗

Refer to task._move internal helper documentation.

(
        self,
        id: str,
        queue: str,
        from_state: str,
        to_state: Optional[str],
        unique: bool,
        when: float,
        mode: Optional[str],
        key_func: Callable[..., str],
        publish_queued_tasks: bool,
        client: Optional[Redis] = None,
    )

Source from the content-addressed store, hash-verified

603 return bool(result)
604
605 def move_task(
606 self,
607 id: str,
608 queue: str,
609 from_state: str,
610 to_state: Optional[str],
611 unique: bool,
612 when: float,
613 mode: Optional[str],
614 key_func: Callable[..., str],
615 publish_queued_tasks: bool,
616 client: Optional[Redis] = None,
617 ) -> Any:
618 """
619 Refer to task._move internal helper documentation.
620 """
621
622 def _bool_to_str(v: bool) -> str:
623 return "true" if v else "false"
624
625 def _none_to_empty_str(v: Optional[str]) -> str:
626 return v or ""
627
628 key_task_id = key_func("task", id)
629 key_task_id_executions = key_func("task", id, "executions")
630 key_task_id_executions_count = key_func("task", id, "executions_count")
631 key_from_state = key_func(from_state)
632 key_to_state = key_func(to_state) if to_state else ""
633 key_active_queue = key_func(ACTIVE, queue)
634 key_queued_queue = key_func(QUEUED, queue)
635 key_error_queue = key_func(ERROR, queue)
636 key_scheduled_queue = key_func(SCHEDULED, queue)
637 key_activity = key_func("activity")
638
639 return self._move_task(
640 keys=[
641 key_task_id,
642 key_task_id_executions,
643 key_task_id_executions_count,
644 key_from_state,
645 key_to_state,
646 key_active_queue,
647 key_queued_queue,
648 key_error_queue,
649 key_scheduled_queue,
650 key_activity,
651 ],
652 args=[
653 id,
654 queue,
655 from_state,
656 _none_to_empty_str(to_state),
657 _bool_to_str(unique),
658 when,
659 _none_to_empty_str(mode),
660 _bool_to_str(publish_queued_tasks),
661 ],
662 client=client,

Callers 1

_moveMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected