use of com.netflix.conductor.util.Constants.TASK_DEFINITION_KEY in project conductor by Netflix.
the class CassandraMetadataDAO method getTaskDefFromDB.
private TaskDef getTaskDefFromDB(String name) {
try {
ResultSet resultSet = session.execute(selectTaskDefStatement.bind(name));
recordCassandraDaoRequests("getTaskDef");
return Optional.ofNullable(resultSet.one()).map(row -> readValue(row.getString(TASK_DEFINITION_KEY), TaskDef.class)).orElse(null);
} catch (Exception e) {
Monitors.error(CLASS_NAME, "getTaskDef");
String errorMsg = String.format("Failed to get task def: %s", name);
LOGGER.error(errorMsg, e);
throw new ApplicationException(Code.BACKEND_ERROR, errorMsg, e);
}
}
use of com.netflix.conductor.util.Constants.TASK_DEFINITION_KEY in project conductor by Netflix.
the class CassandraMetadataDAO method getAllTaskDefsFromDB.
@SuppressWarnings("unchecked")
private List<TaskDef> getAllTaskDefsFromDB() {
try {
ResultSet resultSet = session.execute(selectAllTaskDefsStatement.bind(TASK_DEFS_KEY));
List<Row> rows = resultSet.all();
if (rows.size() == 0) {
LOGGER.info("No task definitions were found.");
return Collections.EMPTY_LIST;
}
return rows.stream().map(row -> readValue(row.getString(TASK_DEFINITION_KEY), TaskDef.class)).collect(Collectors.toList());
} catch (Exception e) {
Monitors.error(CLASS_NAME, "getAllTaskDefs");
String errorMsg = "Failed to get all task defs";
LOGGER.error(errorMsg, e);
throw new ApplicationException(Code.BACKEND_ERROR, errorMsg, e);
}
}
Aggregations