Search in sources :

Example 1 with TASK_DEFS_KEY

use of com.netflix.conductor.util.Constants.TASK_DEFS_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);
    }
}
Also used : Row(com.datastax.driver.core.Row) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) MetadataDAO(com.netflix.conductor.dao.MetadataDAO) Singleton(javax.inject.Singleton) ArrayList(java.util.ArrayList) PreparedStatement(com.datastax.driver.core.PreparedStatement) Inject(javax.inject.Inject) CassandraConfiguration(com.netflix.conductor.cassandra.CassandraConfiguration) ResultSet(com.datastax.driver.core.ResultSet) Session(com.datastax.driver.core.Session) Map(java.util.Map) Code(com.netflix.conductor.core.execution.ApplicationException.Code) TASK_DEFINITION_KEY(com.netflix.conductor.util.Constants.TASK_DEFINITION_KEY) TaskDef(com.netflix.conductor.common.metadata.tasks.TaskDef) ApplicationException(com.netflix.conductor.core.execution.ApplicationException) Logger(org.slf4j.Logger) Trace(com.netflix.conductor.annotations.Trace) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) WorkflowDef(com.netflix.conductor.common.metadata.workflow.WorkflowDef) TASK_DEFS_KEY(com.netflix.conductor.util.Constants.TASK_DEFS_KEY) Collectors(java.util.stream.Collectors) Executors(java.util.concurrent.Executors) Monitors(com.netflix.conductor.metrics.Monitors) Objects(java.util.Objects) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) WORKFLOW_DEF_NAME_VERSION_KEY(com.netflix.conductor.util.Constants.WORKFLOW_DEF_NAME_VERSION_KEY) Statements(com.netflix.conductor.util.Statements) WORKFLOW_DEFINITION_KEY(com.netflix.conductor.util.Constants.WORKFLOW_DEFINITION_KEY) Optional(java.util.Optional) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Comparator(java.util.Comparator) WORKFLOW_DEF_INDEX_KEY(com.netflix.conductor.util.Constants.WORKFLOW_DEF_INDEX_KEY) Collections(java.util.Collections) ApplicationException(com.netflix.conductor.core.execution.ApplicationException) ResultSet(com.datastax.driver.core.ResultSet) Row(com.datastax.driver.core.Row) ApplicationException(com.netflix.conductor.core.execution.ApplicationException)

Aggregations

PreparedStatement (com.datastax.driver.core.PreparedStatement)1 ResultSet (com.datastax.driver.core.ResultSet)1 Row (com.datastax.driver.core.Row)1 Session (com.datastax.driver.core.Session)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Trace (com.netflix.conductor.annotations.Trace)1 CassandraConfiguration (com.netflix.conductor.cassandra.CassandraConfiguration)1 TaskDef (com.netflix.conductor.common.metadata.tasks.TaskDef)1 WorkflowDef (com.netflix.conductor.common.metadata.workflow.WorkflowDef)1 ApplicationException (com.netflix.conductor.core.execution.ApplicationException)1 Code (com.netflix.conductor.core.execution.ApplicationException.Code)1 MetadataDAO (com.netflix.conductor.dao.MetadataDAO)1 Monitors (com.netflix.conductor.metrics.Monitors)1 TASK_DEFINITION_KEY (com.netflix.conductor.util.Constants.TASK_DEFINITION_KEY)1 TASK_DEFS_KEY (com.netflix.conductor.util.Constants.TASK_DEFS_KEY)1 WORKFLOW_DEFINITION_KEY (com.netflix.conductor.util.Constants.WORKFLOW_DEFINITION_KEY)1 WORKFLOW_DEF_INDEX_KEY (com.netflix.conductor.util.Constants.WORKFLOW_DEF_INDEX_KEY)1 WORKFLOW_DEF_NAME_VERSION_KEY (com.netflix.conductor.util.Constants.WORKFLOW_DEF_NAME_VERSION_KEY)1 Statements (com.netflix.conductor.util.Statements)1