Esempio n. 1
0
def returnQueueException(mq, queue):
    excType, excValue, _traceback = sys.exc_info()
    mq.send(queue, json.dumps({'success': False,
                               'data': {'stacktrace': errors.getStacktrace(),
                                        'name': reflect.fullyQualifiedName(excType),
                                        'msg': str(excValue)}}))
    return None
Esempio n. 2
0
def returnQueueException(mq, queue):
    excType, excValue, _traceback = sys.exc_info()
    mq.send(
        queue,
        json.dumps({
            'success': False,
            'data': {
                'stacktrace': errors.getStacktrace(),
                'name': reflect.fullyQualifiedName(excType),
                'msg': str(excValue)
            }
        }))
    return None
Esempio n. 3
0
def runTaskletWithTask(taskName, initialText, tasklets):
    yield tasks.updateTask(
        taskName, lambda t: t.setState(task.TASK_RUNNING).addMessage(
            task.MSG_SILENT, 'Starting to run ' + ' | '.join(tasklets)).update(
                numTasks=len(tasklets)))

    try:
        output = yield runTasklet(taskName, initialText, tasklets)
        yield tasks.updateTask(
            taskName, lambda t: t.setState(task.TASK_COMPLETED).addMessage(
                task.MSG_NOTIFICATION, 'Completed').addResult(output))
    except MetricError, err:
        yield tasks.updateTask(
            taskName, lambda t: t.setState(task.TASK_FAILED).addException(
                str(err), err, errors.getStacktrace()))
        raise err
Esempio n. 4
0
def runTaskletWithTask(taskName, initialText, tasklets):
    yield tasks.updateTask(taskName,
                           lambda t : t.setState(task.TASK_RUNNING
                                                 ).addMessage(task.MSG_SILENT,
                                                              'Starting to run ' + ' | '.join(tasklets)).update(numTasks=len(tasklets)))

    try:
        output = yield runTasklet(taskName, initialText, tasklets)
        yield tasks.updateTask(taskName,
                               lambda t : t.setState(task.TASK_COMPLETED
                                                     ).addMessage(task.MSG_NOTIFICATION, 'Completed'
                                                                  ).addResult(output))
    except MetricError, err:
        yield tasks.updateTask(taskName,
                               lambda t : t.setState(task.TASK_FAILED
                                                     ).addException(str(err), err, errors.getStacktrace()))
        raise err