Package com.blacklocus.qs.worker.model

Examples of com.blacklocus.qs.worker.model.QSTaskModel


        if (!iterator.hasNext()) {
            pageForward();
        }
        S3ObjectSummary obj = iterator.next();
        assert obj != null;
        return new QSTaskModel(listingBatchId, IdSupplier.newId(), taskHandlerIdentifier, 5, obj);
    }
View Full Code Here


        }
    }

    @Override
    public QSTaskModel getAvailableTask() {
        QSTaskModel task = null;
        while (task == null) {
            ReceiveMessageResult result = sqs.receiveMessage(new ReceiveMessageRequest(queueUrl).withMaxNumberOfMessages(1));
            assert result.getMessages().size() <= 1;

            if (result.getMessages().size() == 1) {
View Full Code Here

    @Override
    public Collection<TaskHandle> apply(Collection<QSTaskModel> tasks) {
        List<TaskHandle> taskHandles = new ArrayList<TaskHandle>(tasks.size());
        for (QSTaskModel task : tasks) {
            taskHandles.add(new TaskHandle(task, new QSTaskModel(
                    task.batchId, task.taskId, task.handler, task.remainingAttempts, task.params,
                    workerIdService.getWorkerId(), System.currentTimeMillis(), null, null, false)
            ));
        }
        return taskHandles;
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    @Override
    public Object process(TaskHandle taskHandle) throws Exception {
        QSTaskModel task = taskHandle.task;
        QSWorker worker = workers.get(task.handler);
        if (worker == null) {
            throw new RuntimeException("No worker available for handler identifier: " + task.handler);
        }
View Full Code Here

    @Override
    public void onSuccess(TaskHandle taskHandle, TaskHandle convertedTaskHandle, Object result) {
        queueingStrategy.onBeforeRemove();

        QSTaskModel task = taskHandle.task;
        taskService.closeTask(task);
        LOG.info("Task succeeded: {}", task);

        taskHandle.logTask.finishedHappy = true;
    }
View Full Code Here

    @Override
    public void onError(TaskHandle taskHandle, TaskHandle convertedTaskHandle, Throwable throwable) {
        queueingStrategy.onBeforeRemove();

        QSTaskModel task = taskHandle.task;

        ImmutableMap<String, ImmutableMap<String, String>> exceptionDetails = ImmutableMap.of("exception", ImmutableMap.of(
                "class", throwable.getClass().getName(),
                "message", throwable.getMessage(),
                "stackTrace", ExceptionUtils.getStackTrace(throwable)
View Full Code Here

        taskHandle.logTask.finishedHappy = false;
    }

    @Override
    public void onComplete(TaskHandle taskHandle, TaskHandle convertedTaskHandle, Object result) {
        QSTaskModel task = taskHandle.task;
        QSTaskModel logTask = taskHandle.logTask;

        logTask.finished = System.currentTimeMillis();
        logTask.elapsed = logTask.finished - logTask.started;
        logService.completedTask(logTask);
View Full Code Here

        @Override
        protected void go() throws Exception {
            // If the heap is filling up, this should block for a bit. queueStrategy.on*Remove called when
            // task processing completes in the WorkerQueueItemHandler.
            queueingStrategy.onBeforeAdd(null);
            QSTaskModel task = taskService.getAvailableTask();
            taskServices.put(task, taskService);
            transferQueue.put(task);
            queueingStrategy.onAfterAdd();
        }
View Full Code Here

        this.elapsed = elapsed;
        this.finishedHappy = finishedHappy;
    }

    public QSTaskModel toNormalModel() {
        return new QSTaskModel(batchId, taskId, handler, remainingAttempts,
                ObjectMappers.valueToTree(params.get(handler)),
                workerId, started, finished, elapsed, finishedHappy);
    }
View Full Code Here

        this.elapsed = elapsed;
        this.finishedHappy = finishedHappy;
    }

    public QSTaskModel toNormalModel() {
        return new QSTaskModel(batchId, taskId, handler, remainingAttempts, params.get(handler),
                workerId, started, finished, elapsed, finishedHappy);
    }
View Full Code Here

TOP

Related Classes of com.blacklocus.qs.worker.model.QSTaskModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.