use of org.batfish.datamodel.EnvironmentMetadata in project batfish by batfish.
the class WorkQueueMgr method getBlockerForDataplaningWork.
private QueuedWork getBlockerForDataplaningWork(QueuedWork work) throws IOException {
WorkItem wItem = work.getWorkItem();
WorkDetails wDetails = work.getDetails();
QueuedWork currentParsingWork = getIncompleteWork(wItem.getContainerName(), wDetails.baseTestrig, wDetails.baseEnv, WorkType.PARSING);
EnvironmentMetadata envMetadata = TestrigMetadataMgr.getEnvironmentMetadata(wItem.getContainerName(), wDetails.baseTestrig, wDetails.baseEnv);
switch(envMetadata.getProcessingStatus()) {
case UNINITIALIZED:
case PARSING_FAIL:
case PARSING:
if (currentParsingWork == null) {
throw new BatfishException(String.format("Cannot queue dataplane work for %s / %s: " + "Status is %s but no incomplete parsing work exists", wDetails.baseTestrig, wDetails.baseEnv, envMetadata.getProcessingStatus()));
}
return currentParsingWork;
case PARSED:
return currentParsingWork;
case DATAPLANING:
// we get here only when currentDataplaningWork is null; by virtue of the calling context
throw new BatfishException(String.format("Cannot queue dataplane work for %s / %s: " + "Status is %s but no incomplete dataplaning work exists", wDetails.baseTestrig, wDetails.baseEnv, envMetadata.getProcessingStatus()));
case DATAPLANED:
case DATAPLANING_FAIL:
return null;
default:
throw new BatfishException("Unknown testrig processingStatus: " + envMetadata.getProcessingStatus());
}
}
use of org.batfish.datamodel.EnvironmentMetadata in project batfish by batfish.
the class TestrigMetadataMgr method updateEnvironmentStatus.
public static synchronized void updateEnvironmentStatus(String container, String testrig, String envName, ProcessingStatus status, String errMessage) throws IOException {
Path metadataPath = WorkMgr.getpathTestrigMetadata(container, testrig);
TestrigMetadata trMetadata = readMetadata(metadataPath);
EnvironmentMetadata environmentMetadata = trMetadata.getEnvironments().get(envName);
environmentMetadata.updateStatus(status, errMessage);
writeMetadata(trMetadata, metadataPath);
}
Aggregations