use of com.walmartlabs.concord.dependencymanager.ProgressListener in project concord by walmartlabs.
the class RunnerJobExecutor method resolveDeps.
private Collection<String> resolveDeps(RunnerJob job) throws Exception {
job.getLog().info("Resolving process dependencies...");
long t1 = System.currentTimeMillis();
// combine the default dependencies and the process' dependencies
Collection<URI> uris = Stream.concat(defaultDependencies.getDependencies().stream(), JobDependencies.get(job).stream()).collect(Collectors.toList());
uris = rewriteDependencies(job, uris);
Collection<DependencyEntity> deps = dependencyManager.resolve(uris, new ProgressListener() {
@Override
public void onRetry(int retryCount, int maxRetry, long interval, String cause) {
job.getLog().warn("Error while downloading dependencies: {}", cause);
job.getLog().info("Retrying in {}ms", interval);
}
@Override
public void onTransferFailed(String error) {
job.getLog().error(error);
}
});
// check the resolved dependencies against the current policy
validateDependencies(job, deps);
// sort dependencies to maintain consistency in runner configurations
Collection<String> paths = deps.stream().map(DependencyEntity::getPath).map(p -> p.toAbsolutePath().toString()).sorted().collect(Collectors.toList());
long t2 = System.currentTimeMillis();
if (job.isDebugMode()) {
job.getLog().info("Dependency resolution took {}ms", (t2 - t1));
logDependencies(job, paths);
} else {
logDependencies(job, uris);
}
return paths;
}
use of com.walmartlabs.concord.dependencymanager.ProgressListener in project concord by walmartlabs.
the class DependencyResolver method resolveDeps.
public Collection<String> resolveDeps(ProcessDefinition processDefinition) throws Exception {
if (verbose) {
System.out.println("Resolving process dependencies...");
}
long t1 = System.currentTimeMillis();
// combine the default dependencies and the process' dependencies
Collection<URI> uris = Stream.concat(defaultDependencies.stream(), normalizeUrls(processDefinition.configuration().dependencies()).stream()).collect(Collectors.toList());
Collection<DependencyEntity> deps = dependencyManager.resolve(uris, new ProgressListener() {
@Override
public void onRetry(int retryCount, int maxRetry, long interval, String cause) {
System.err.println("Error while downloading dependencies: " + cause);
System.err.println("Retrying in " + interval + "ms");
}
@Override
public void onTransferFailed(String error) {
System.err.println("Transfer failed: " + error);
}
});
// sort dependencies to maintain consistency in runner configurations
Collection<String> paths = deps.stream().map(DependencyEntity::getPath).map(p -> p.toAbsolutePath().toString()).sorted().collect(Collectors.toList());
long t2 = System.currentTimeMillis();
if (verbose) {
System.out.println("Dependency resolution took " + ((t2 - t1)) + "ms");
logDependencies(paths);
}
return paths;
}
Aggregations