void removeActiveExecutableReference(final int execId) throws ExecutorManagerException { final String DELETE = "DELETE FROM active_executing_flows WHERE exec_id=?"; try { this.dbOperator.update(DELETE, execId); } catch (final SQLException e) { throw new ExecutorManagerException( "Error deleting active flow reference " + execId, e); } }
private void addExecutorHelper(final String host, final int port) throws ExecutorManagerException { final String INSERT = "INSERT INTO executors (host, port) values (?,?)"; try { this.dbOperator.update(INSERT, host, port); } catch (final SQLException e) { throw new ExecutorManagerException(String.format("Error adding %s:%d ", host, port), e); } }
public int fetchNumExecutableNodes(final int projectId, final String jobId) throws ExecutorManagerException { final IntHandler intHandler = new IntHandler(); try { return this.dbOperator.query(IntHandler.NUM_JOB_EXECUTIONS, intHandler, projectId, jobId); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching num executions", e); } }
List<Executor> fetchActiveExecutors() throws ExecutorManagerException { try { return this.dbOperator .query(FetchExecutorHandler.FETCH_ACTIVE_EXECUTORS, new FetchExecutorHandler()); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching active executors", e); } }
public int fetchNumExecutableFlows() throws ExecutorManagerException { try { return this.dbOperator.query(IntHandler.NUM_EXECUTIONS, new IntHandler()); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching num executions", e); } }
List<ExecutableFlow> fetchFlowHistory(final int skip, final int num) throws ExecutorManagerException { try { return this.dbOperator.query(FetchExecutableFlows.FETCH_ALL_EXECUTABLE_FLOW_HISTORY, new FetchExecutableFlows(), skip, num); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching flow History", e); } }
public Pair<Props, Props> fetchExecutionJobProps(final int execId, final String jobId) throws ExecutorManagerException { try { return this.dbOperator.query( FetchExecutableJobPropsHandler.FETCH_INPUT_OUTPUT_PARAM_EXECUTABLE_NODE, new FetchExecutableJobPropsHandler(), execId, jobId); } catch (final SQLException e) { throw new ExecutorManagerException("Error querying job params " + execId + " " + jobId, e); } }
List<ExecutableFlow> fetchFlowHistory(final int projectId, final String flowId, final int skip, final int num) throws ExecutorManagerException { try { return this.dbOperator.query(FetchExecutableFlows.FETCH_EXECUTABLE_FLOW_HISTORY, new FetchExecutableFlows(), projectId, flowId, skip, num); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching flow history", e); } }
public List<Pair<ExecutionReference, ExecutableFlow>> fetchQueuedFlows() throws ExecutorManagerException { try { return this.dbOperator.query(FetchQueuedExecutableFlows.FETCH_QUEUED_EXECUTABLE_FLOW, new FetchQueuedExecutableFlows()); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching active flows", e); } }
List<Executor> fetchAllExecutors() throws ExecutorManagerException { try { return this.dbOperator .query(FetchExecutorHandler.FETCH_ALL_EXECUTORS, new FetchExecutorHandler()); } catch (final Exception e) { throw new ExecutorManagerException("Error fetching executors", e); } }
LogData fetchLogs(final int execId, final String name, final int attempt, final int startByte, final int length) throws ExecutorManagerException { final FetchLogsHandler handler = new FetchLogsHandler(startByte, length + startByte); try { return this.dbOperator.query(FetchLogsHandler.FETCH_LOGS, handler, execId, name, attempt, startByte, startByte + length); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching logs " + execId + " : " + name, e); } }
public void postExecutorEvent(final Executor executor, final EventType type, final String user, final String message) throws ExecutorManagerException { final String INSERT_PROJECT_EVENTS = "INSERT INTO executor_events (executor_id, event_type, event_time, username, message) values (?,?,?,?,?)"; try { this.dbOperator.update(INSERT_PROJECT_EVENTS, executor.getId(), type.getNumVal(), new Date(), user, message); } catch (final SQLException e) { throw new ExecutorManagerException("Failed to post executor event", e); } }
public Props fetchExecutionJobInputProps(final int execId, final String jobId) throws ExecutorManagerException { try { final Pair<Props, Props> props = this.dbOperator.query( FetchExecutableJobPropsHandler.FETCH_INPUT_PARAM_EXECUTABLE_NODE, new FetchExecutableJobPropsHandler(), execId, jobId); return props.getFirst(); } catch (final SQLException e) { throw new ExecutorManagerException("Error querying job params " + execId + " " + jobId, e); } }
@Override public Executor fetchExecutorByExecutionId(final int execId) throws ExecutorManagerException { if (this.executionExecutorMapping.containsKey(execId)) { return fetchExecutor(this.executionExecutorMapping.get(execId)); } else { throw new ExecutorManagerException( "Failed to find executor with execution : " + execId); } }
List<ExecutableFlow> fetchFlowHistory(final int projectId, final String flowId, final int skip, final int num, final Status status) throws ExecutorManagerException { try { return this.dbOperator.query(FetchExecutableFlows.FETCH_EXECUTABLE_FLOW_BY_STATUS, new FetchExecutableFlows(), projectId, flowId, status.getNumVal(), skip, num); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching active flows", e); } }
List<ExecutableFlow> fetchRecentlyFinishedFlows(final Duration maxAge) throws ExecutorManagerException { try { return this.dbOperator.query(FetchRecentlyFinishedFlows.FETCH_RECENTLY_FINISHED_FLOW, new FetchRecentlyFinishedFlows(), System.currentTimeMillis() - maxAge.toMillis(), Status.SUCCEEDED.getNumVal(), Status.KILLED.getNumVal(), Status.FAILED.getNumVal()); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching recently finished flows", e); } }
public static ExecutorManagerException createTestStracktrace() { final ExecutorManagerException exception = new ExecutorManagerException("mocked failure"); // set custom stacktrace to have deterministic string for comparison exception.setStackTrace(new StackTraceElement[]{new StackTraceElement( DefaultMailCreatorTest.class.getCanonicalName(), "createFailedUpdateMessage", "DefaultMailCreatorTest.java", 135)}); return exception; }
public Props fetchExecutionJobOutputProps(final int execId, final String jobId) throws ExecutorManagerException { try { final Pair<Props, Props> props = this.dbOperator.query( FetchExecutableJobPropsHandler.FETCH_OUTPUT_PARAM_EXECUTABLE_NODE, new FetchExecutableJobPropsHandler(), execId, jobId); return props.getFirst(); } catch (final SQLException e) { throw new ExecutorManagerException("Error querying job params " + execId + " " + jobId, e); } }
void addActiveExecutableReference(final ExecutionReference reference) throws ExecutorManagerException { final String INSERT = "INSERT INTO active_executing_flows " + "(exec_id, update_time) values (?,?)"; try { this.dbOperator.update(INSERT, reference.getExecId(), reference.getUpdateTime()); } catch (final SQLException e) { throw new ExecutorManagerException( "Error updating active flow reference " + reference.getExecId(), e); } }
public List<ExecutorLogEvent> getExecutorEvents(final Executor executor, final int num, final int offset) throws ExecutorManagerException { try { return this.dbOperator.query(ExecutorLogsResultHandler.SELECT_EXECUTOR_EVENTS_ORDER, new ExecutorLogsResultHandler(), executor.getId(), num, offset); } catch (final SQLException e) { throw new ExecutorManagerException( "Failed to fetch events for executor id : " + executor.getId(), e); } }