Esempio n. 1
0
def node_startup(task_id, node=None, **kwargs):
    """
    Create esysinfo execute task. Called when node_online signal is received.
    """
    # Automatic switch to online status happens via node_worker_status_update, which is always accompanied by
    # fast worker startup. So we don't need to react to this signal
    if not kwargs.get('automatic', False):
        user_id, owner_id = user_owner_ids_from_task_id(task_id)
        execute_sysinfo(user_id, owner_id, node.fast_queue, node.uuid)
Esempio n. 2
0
def node_worker_start(sender):
    """
    Node worker startup handler.
    """
    worker = sender.split('@')

    if worker[0].startswith(Q_FAST):
        queue = '%s.%s' % (Q_FAST, worker[1])

        try:
            node_uuid = fetch_node_uuid()
        except NodeError as exc:
            logger.exception(exc)
            return

        tid, err = execute_sysinfo(ERIGONES_TASK_USER,
                                   ERIGONES_TASK_USER,
                                   queue=queue,
                                   node_uuid=node_uuid,
                                   initial=True)
        if err:
            logger.error('Error creating internal %s task: %s in %s queue',
                         SYSINFO_TASK, err, queue)
        else:
            logger.warning('Created internal %s task %s in %s queue',
                           SYSINFO_TASK, tid, queue)
Esempio n. 3
0
    def put(self):
        """
        Performs call to execute_sysinfo
        """
        if not self.node.is_online():
            raise NodeIsNotOperational()

        apiview = {
            'view': 'node_sysinfo',
            'method': self.request.method,
            'hostname': self.node.hostname,
        }
        meta = {
            'apiview': apiview,
            'msg': LOG_NODE_UPDATE,
            'node_uuid': self.node.uuid,

        }
        task_id, err = execute_sysinfo(self.request, self.node.owner.id, queue=self.node.fast_queue, meta=meta,
                                       node_uuid=self.node.uuid, check_user_tasks=True)

        if err:
            return FailureTaskResponse(self.request, err)
        else:
            return TaskResponse(self.request, task_id, api_view=apiview, obj=self.node, msg=LOG_NODE_UPDATE,
                                data=self.data)