Executing slave pipelines

From CCIL
Revision as of 12:37, 2 June 2017 by Atanas.ilchev (Talk | contribs)

Jump to: navigation, search

Inline

	@Override
	public void run() throws ExecutionException {
		ResultSet rs = getStageInput(ResultSet.class);
		int limit = confInt(StageConfig.Keys.Limit);
		String process = confStr(StageConfig.Keys.Process);

		long c = 0L;
		try {
			while (rs.next()) {
				c = c + 1L;

				// run nested pipeline
				SlavePipelineApp processApp = new SlavePipelineApp(
						LocalServer.getSubsystem(IPlatformServer.class), env,
						process);

				processApp.runContext(env.getContext(), rs, null);
				if (limit > 0 && c >= limit) {
					if (log.isInfoEnabled()) {
						log.info(String
								.format("the limit of %d has been reached, exiting store iteration..",
										limit));
					}
					break;
				}
			}

		} catch (SQLException e) {
			throw new ExecutionException("rs.next failed", e);
		}
	}