Registers the celery tasks on the hub object.
436719
def init_celery(self, celery):
        """"""

        count = next(self.counter)

        def task_with_hub(f, **opts):
            @functools.wraps(f)
            def wrapper(*args, **kwargs):
                return f(self, *args, **kwargs)
            # Make sure newer instances don't overwride older ones.
            wrapper.__name__ = wrapper.__name__ + '_' + str(count)
            return celery.task(**opts)(wrapper)

        # tasks for internal use:
        self.subscribe = task_with_hub(subscribe)
        self.unsubscribe = task_with_hub(unsubscribe)

        max_attempts = self.config.get('MAX_ATTEMPTS', 10)
        make_req = task_with_hub(make_request_retrying, bind=True,
                                 max_retries=max_attempts)
        self.make_request_retrying = make_req

        # user facing tasks

        # wrapped by send_change_notification:
        self.send_change = task_with_hub(send_change_notification)

        # wrapped by cleanup_expired_subscriptions
        @task_with_hub
        def cleanup(hub):
            self.storage.cleanup_expired_subscriptions()
        self.cleanup = cleanup

        # wrapped by schedule_cleanup
        def schedule(every_x_seconds=A_DAY):
            celery.add_periodic_task(every_x_seconds,
                                     self.cleanup_expired_subscriptions.s())
        self.schedule = schedule
1177776
def register_workflow(self, name, workflow):
        """"""
        assert name not in self.workflows
        self.workflows[name] = workflow
683053
def initiate_tasks(self):
        
        self.tasks_classes = TaskLoader().load_tasks(
            paths=self.configuration[Configuration.ALGORITHM][Configuration.TASKS][Configuration.PATHS])
783556
def register(self):
        
        if not self.registered:
            self.registered = True
            if self.parent:
                self.parent.register(self)
379940
def task(name, options = {}, &block)
      AvoDeploy::Deployment.instance.log.debug "registering task #{name}..."
      AvoDeploy::Deployment.instance.task_manager.add_task(name, options, &block)
    end
871180
def add(self, *tasks):
        
        nodes = [x.node for x in tasks]
        self.node.add(*nodes)
        return self
1137305
protected function registerTaskCallback()
    {
        $this->swooleServer->on('Task', function ($server, $taskId, $srcWorkerId, $data) {
            $this->events->dispatch(new Events\TaskTriggered($this, $taskId, $srcWorkerId, $data));

            $this->dispatchEvent('Task', $this, $taskId, $srcWorkerId, $data);
        });
    }
60097
public final void registerStatus(TaskStatus status) {
	TaskStatus.validate(this.status, status);
	this.status = status;
	if (status.equals(TaskStatus.SUBMITTED)) {
	  clear();
	}
  }
652750
def _register_task(self, output_type, rule, union_rules):
    """"""
    func = Function(self._to_key(rule.func))
    self._native.lib.tasks_task_begin(self._tasks, func, self._to_type(output_type), rule.cacheable)
    for selector in rule.input_selectors:
      self._native.lib.tasks_add_select(self._tasks, self._to_type(selector))

    def add_get_edge(product, subject):
      self._native.lib.tasks_add_get(self._tasks, self._to_type(product), self._to_type(subject))

    for the_get in rule.input_gets:
      union_members = union_rules.get(the_get.subject_declared_type, None)
      if union_members:
        # If the registered subject type is a union, add Get edges to all registered union members.
        for union_member in union_members:
          add_get_edge(the_get.product, union_member)
      else:
        # Otherwise, the Get subject is a "concrete" type, so add a single Get edge.
        add_get_edge(the_get.product, the_get.subject_declared_type)

    self._native.lib.tasks_task_end(self._tasks)
895581
protected function registerSingletons()
    {
        App::singleton('cms.helper', function () {
            return new \Cms\Helpers\Cms;
        });

        App::singleton('backend.helper', function () {
            return new \Backend\Helpers\Backend;
        });

        App::singleton('backend.menu', function () {
            return \Backend\Classes\NavigationManager::instance();
        });

        App::singleton('backend.auth', function () {
            return \Backend\Classes\AuthManager::instance();
        });
    }
278794
protected function registerFinishCallback()
    {
        $this->swooleServer->on('Finish', function ($server, $taskId, $data) {
            $this->events->dispatch(new Events\TaskFinished($this, $taskId, $data));

            $this->dispatchEvent('Finish', $this, $taskId, $data);
        });
    }
718925
def register_sigma_task(self, *args, **kwargs):
        """"""
        kwargs["task_class"] = SigmaTask
        return self.register_task(*args, **kwargs)
983195
def register_for_duty(self, context):
        """"""
        cctxt = self.client.prepare()
        return cctxt.call(context, 'register_for_duty', host=self.host)
1168879
def register_periodic_tasks(self, tasks: Iterable[Task]):
        """"""
        tasks = [task.serialize() for task in tasks]
        self._number_periodic_tasks = len(tasks)
        self._run_script(
            self._register_periodic_tasks,
            math.ceil(datetime.now(timezone.utc).timestamp()),
            self._to_namespaced(PERIODIC_TASKS_HASH_KEY),
            self._to_namespaced(PERIODIC_TASKS_QUEUE_KEY),
            *tasks
        )
988808
def _register_dependencies(self):
        
        for tree_name, context_entry in context.timetable_context.items():
            tree = self.trees[tree_name]
            assert isinstance(tree, MultiLevelTree)
            for dependent_on in context_entry.dependent_on:
                dependent_on_tree = self.trees[dependent_on]
                assert isinstance(dependent_on_tree, MultiLevelTree)
                tree.register_dependent_on(dependent_on_tree)
68334
def execute_work_items(work_items, config):
    
    return celery.group(
        worker_task.s(work_item, config)
        for work_item in work_items
    )
166755
def attach_tasks(self, tasks: Tasks):
        
        if tasks._spin is not None and tasks._spin is not self:
            logger.warning('Tasks already attached to a different Engine')
        self._tasks.update(tasks)
        tasks._spin = self