/** * Writes the workflow tokens modified by this program to the given URL connection. */ private void writeWorkflowToken(@Nullable BasicWorkflowToken workflowToken, HttpURLConnection urlConn) throws IOException { try (Writer writer = new OutputStreamWriter(urlConn.getOutputStream(), Charsets.UTF_8)) { if (workflowToken != null) { GSON.toJson(Maps.transformValues(workflowToken.getAllFromCurrentNode(), Functions.toStringFunction()), TOKEN_TYPE, writer); } } }
/** * Writes the workflow tokens modified by this program to the given URL connection. */ private void writeWorkflowToken(@Nullable BasicWorkflowToken workflowToken, HttpURLConnection urlConn) throws IOException { try (Writer writer = new OutputStreamWriter(urlConn.getOutputStream(), Charsets.UTF_8)) { if (workflowToken != null) { GSON.toJson(Maps.transformValues(workflowToken.getAllFromCurrentNode(), Functions.toStringFunction()), TOKEN_TYPE, writer); } } }
/** * Writes the workflow tokens modified by this program to the given URL connection. */ private void writeWorkflowToken(@Nullable BasicWorkflowToken workflowToken, HttpURLConnection urlConn) throws IOException { try (Writer writer = new OutputStreamWriter(urlConn.getOutputStream(), Charsets.UTF_8)) { if (workflowToken != null) { GSON.toJson(Maps.transformValues(workflowToken.getAllFromCurrentNode(), Functions.toStringFunction()), TOKEN_TYPE, writer); } } }
/** * Calls the heartbeat endpoint and handle the {@link SparkCommand}. * returned from the call. */ private void heartbeat(SparkExecutionClient client, @Nullable BasicWorkflowToken workflowToken) throws Exception { LOG.trace("Sending heartbeat with workflow token {}", workflowToken == null ? null : workflowToken.getAllFromCurrentNode()); SparkCommand command = client.heartbeat(workflowToken); if (command == null) { return; } if (SparkCommand.STOP.equals(command)) { LOG.info("Stop command received from client. Stopping spark program."); stop(); } else { LOG.warn("Ignoring unsupported command {}", command); } } }
/** * Calls the heartbeat endpoint and handle the {@link SparkCommand}. * returned from the call. */ private void heartbeat(SparkExecutionClient client, @Nullable BasicWorkflowToken workflowToken) throws Exception { LOG.trace("Sending heartbeat with workflow token {}", workflowToken == null ? null : workflowToken.getAllFromCurrentNode()); SparkCommand command = client.heartbeat(workflowToken); if (command == null) { return; } if (SparkCommand.STOP.equals(command)) { LOG.info("Stop command received from client. Stopping spark program."); stop(); } else { LOG.warn("Ignoring unsupported command {}", command); } } }
/** * Calls the heartbeat endpoint and handle the {@link SparkCommand}. * returned from the call. */ private void heartbeat(SparkExecutionClient client, @Nullable BasicWorkflowToken workflowToken) throws Exception { LOG.trace("Sending heartbeat with workflow token {}", workflowToken == null ? null : workflowToken.getAllFromCurrentNode()); SparkCommand command = client.heartbeat(workflowToken); if (command == null) { return; } if (SparkCommand.STOP.equals(command)) { LOG.info("Stop command received from client. Stopping spark program."); stop(); } else { LOG.warn("Ignoring unsupported command {}", command); } } }