Search in sources :

Example 1 with Batch

use of org.batfish.common.Task.Batch in project batfish by batfish.

the class Driver method newBatch.

public static synchronized AtomicInteger newBatch(Settings settings, String description, int jobs) {
    Batch batch = null;
    Task task = getTask(settings);
    if (task != null) {
        batch = task.newBatch(description);
        batch.setSize(jobs);
        return batch.getCompleted();
    } else {
        return new AtomicInteger();
    }
}
Also used : Task(org.batfish.common.Task) Batch(org.batfish.common.Task.Batch) AtomicInteger(java.util.concurrent.atomic.AtomicInteger)

Example 2 with Batch

use of org.batfish.common.Task.Batch in project batfish by batfish.

the class Client method printWorkStatusResponse.

private void printWorkStatusResponse(Pair<WorkStatusCode, String> response, boolean unconditionalPrint) {
    if (unconditionalPrint || _logger.getLogLevel() >= BatfishLogger.LEVEL_INFO) {
        WorkStatusCode status = response.getFirst();
        _logger.outputf("status: %s\n", status);
        Task task;
        try {
            task = BatfishObjectMapper.mapper().readValue(response.getSecond(), Task.class);
        } catch (IOException e) {
            _logger.errorf("Could not deserialize task object: %s\n", e);
            return;
        }
        if (task == null) {
            _logger.outputf(".... no task information\n");
            return;
        }
        List<Batch> batches = task.getBatches();
        // else print all
        for (int i = 0; i < batches.size(); i++) {
            if (i == batches.size() - 1 || status.isTerminated()) {
                _logger.outputf(".... %s\n", batches.get(i));
            } else {
                _logger.debugf(".... %s\n", batches.get(i));
            }
        }
        if (status.isTerminated()) {
            _logger.outputf(".... %s: %s\n", task.getTerminated(), status);
        }
    }
}
Also used : Task(org.batfish.common.Task) WorkStatusCode(org.batfish.common.CoordConsts.WorkStatusCode) Batch(org.batfish.common.Task.Batch) IOException(java.io.IOException)

Aggregations

Task (org.batfish.common.Task)2 Batch (org.batfish.common.Task.Batch)2 IOException (java.io.IOException)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 WorkStatusCode (org.batfish.common.CoordConsts.WorkStatusCode)1