void removeExecutor(final String host, final int port) throws ExecutorManagerException { final String DELETE = "DELETE FROM executors WHERE host=? AND port=?"; try { final int rows = this.dbOperator.update(DELETE, host, port); if (rows == 0) { throw new ExecutorManagerException("No executor with host, port :" + "(" + host + "," + port + ")"); } } catch (final SQLException e) { throw new ExecutorManagerException("Error removing executor with host, port : " + "(" + host + "," + port + ")", e); } }
/** * Get all metrics tracked by the given executor */ private void handleGetAllMetricName(final int executorId, final HttpServletRequest req, final HashMap<String, Object> ret) throws IOException { final Map<String, Object> result; try { result = this.execManagerAdapter.callExecutorStats(executorId, ConnectorParams.STATS_GET_ALLMETRICSNAME, (Pair<String, String>[]) null); if (result.containsKey(ConnectorParams.RESPONSE_ERROR)) { ret.put("error", result.get(ConnectorParams.RESPONSE_ERROR).toString()); } else { ret.put("metricList", result.get("data")); } } catch (final ExecutorManagerException e) { logger.error(e.getMessage(), e); ret.put("error", "Failed to fetch metric names for executor : " + executorId); } }
@Override public Object eval() { logger.info("Checking sla for execution " + this.execId); final ExecutableFlow flow; try { flow = this.executorLoader.fetchExecutableFlow(this.execId); } catch (final ExecutorManagerException e) { logger.error("Can't get executable flow.", e); e.printStackTrace(); // something wrong, send out alerts return Boolean.TRUE; } return isSlaMissed(flow); }
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; }
page.add("error", e.getMessage()); page.add("error", e.getMessage()); pageSize); } catch (final ExecutorManagerException e) { e.printStackTrace();
action.doAction(); } catch (final ExecutorManagerException e) { if (e.getReason() == ExecutorManagerException.Reason.SkippedExecution) { logger.info("Skipped action [" + action.getDescription() + "] for [" + t + "] because: " + e.getMessage()); } else { logger.error("Failed to do action [" + action.getDescription() + "] for [" + t + "]",
final ExecutableFlow flow = e.getExecutableFlow(); logger.error(e);
private void handleAjaxExecute(HttpServletRequest req, Map<String, Object> respMap, int execId) throws ServletException { try { flowRunnerManager.submitFlow(execId); } catch (ExecutorManagerException e) { e.printStackTrace(); logger.error(e); respMap.put(RESPONSE_ERROR, e.getMessage()); } }
final ExecutableFlow flow = e.getExecutableFlow(); logger.error(e);
/** * parse a string as number and throws exception if parsed value is not a valid integer * * @throws ExecutorManagerException if paramName is not a valid integer */ public static boolean validateIntegerParam(final Map<String, String> params, final String paramName) throws ExecutorManagerException { if (params != null && params.containsKey(paramName) && !StringUtils.isNumeric(params.get(paramName))) { throw new ExecutorManagerException(paramName + " should be an integer"); } return true; }
/** * Get metric snapshots for a metric and date specification */ private void handleGetMetricHistory(final int executorId, final HttpServletRequest req, final HashMap<String, Object> ret, final User user) throws IOException, ServletException { try { final Map<String, Object> result = this.execManagerAdapter.callExecutorStats(executorId, ConnectorParams.STATS_GET_METRICHISTORY, getAllParams(req)); if (result.containsKey(ConnectorParams.RESPONSE_ERROR)) { ret.put(ConnectorParams.RESPONSE_ERROR, result.get(ConnectorParams.RESPONSE_ERROR).toString()); } else { ret.put("data", result.get("data")); } } catch (final ExecutorManagerException ex) { logger.error(ex.getMessage(), ex); ret.put("error", "Failed to fetch metric history"); } }
private void handleAjaxResume(Map<String, Object> respMap, int execid, String user) throws ServletException { if (user == null) { respMap.put(RESPONSE_ERROR, "user has not been set"); return; } try { flowRunnerManager.resumeFlow(execid, user); respMap.put(STATUS_PARAM, RESPONSE_SUCCESS); } catch (ExecutorManagerException e) { e.printStackTrace(); respMap.put(RESPONSE_ERROR, e.getMessage()); } }
@Override public Object eval() { final ExecutableFlow exflow; try { exflow = executorManagerAdapter.getExecutableFlow(this.execId); } catch (final ExecutorManagerException e) { e.printStackTrace(); return Boolean.FALSE; } if (this.jobName != null) { final ExecutableNode job = exflow.getExecutableNode(this.jobName); if (job != null) { return job.getStatus().equals(this.wantedStatus); } else { return Boolean.FALSE; } } else { return exflow.getStatus().equals(this.wantedStatus); } }
ExecutableFlow flow = e.getExecutableFlow(); logger.error(e);
void unassignExecutor(final int executionId) throws ExecutorManagerException { final String UPDATE = "UPDATE execution_flows SET executor_id=NULL where exec_id=?"; try { final int rows = this.dbOperator.update(UPDATE, executionId); if (rows == 0) { throw new ExecutorManagerException(String.format( "Failed to unassign executor for execution : %d ", executionId)); } } catch (final SQLException e) { throw new ExecutorManagerException("Error updating execution id " + executionId, e); } } }
/** * Generic method to facilitate actionName action using Azkaban exec server * * @param actionName Name of the action */ private void handleChangeConfigurationRequest(final int executorId, final String actionName, final HttpServletRequest req, final HashMap<String, Object> ret) throws ServletException, IOException { try { final Map<String, Object> result = this.execManagerAdapter .callExecutorStats(executorId, actionName, getAllParams(req)); if (result.containsKey(ConnectorParams.RESPONSE_ERROR)) { ret.put(ConnectorParams.RESPONSE_ERROR, result.get(ConnectorParams.RESPONSE_ERROR).toString()); } else { ret.put(ConnectorParams.STATUS_PARAM, result.get(ConnectorParams.STATUS_PARAM)); } } catch (final ExecutorManagerException ex) { logger.error(ex.getMessage(), ex); ret.put("error", "Failed to change config change"); } }
e.printStackTrace(); ret.put("error", "Error submitting flow " + exflow.getFlowId() + ". " + e.getMessage());
private void cleanOldExecutionLogs(long millis) { try { int count = executorLoader.removeExecutionLogsByTime(millis); logger.info("Cleaned up " + count + " log entries."); } catch (ExecutorManagerException e) { e.printStackTrace(); } }
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 ajaxReloadExecutors(final HttpServletRequest req, final HttpServletResponse resp, final HashMap<String, Object> returnMap, final User user) { boolean wasSuccess = false; if (HttpRequestUtils.hasPermission(this.userManager, user, Type.ADMIN)) { try { this.executorManagerAdapter.setupExecutors(); returnMap.put(ConnectorParams.STATUS_PARAM, ConnectorParams.RESPONSE_SUCCESS); wasSuccess = true; } catch (final ExecutorManagerException e) { returnMap.put(ConnectorParams.RESPONSE_ERROR, "Failed to refresh the executors " + e.getMessage()); } } else { returnMap.put(ConnectorParams.RESPONSE_ERROR, "Only Admins are allowed to refresh the executors"); } if (!wasSuccess) { returnMap.put(ConnectorParams.STATUS_PARAM, ConnectorParams.RESPONSE_ERROR); } }