use of org.apache.gobblin.runtime.cli.ConstructorAndPublicMethodsCliObjectFactory in project incubator-gobblin by apache.
the class ConfigClientCLI method run.
@Override
public void run(String[] args) throws Exception {
CliObjectFactory<Command> factory = new ConstructorAndPublicMethodsCliObjectFactory<>(Command.class);
Command command = factory.buildObject(args, 1, true, args[0]);
ConfigClient configClient = ConfigClient.createConfigClient(VersionStabilityPolicy.READ_FRESHEST);
if (command.resolvedConfig) {
Config resolvedConfig = configClient.getConfig(command.uri);
System.out.println(resolvedConfig.root().render(ConfigRenderOptions.defaults()));
}
}
use of org.apache.gobblin.runtime.cli.ConstructorAndPublicMethodsCliObjectFactory in project incubator-gobblin by apache.
the class StateStoreMigrationCli method run.
@Override
public void run(String[] args) throws Exception {
CliObjectFactory<Command> factory = new ConstructorAndPublicMethodsCliObjectFactory<>(Command.class);
Command command = factory.buildObject(args, 1, true, args[0]);
FileSystem fs = FileSystem.get(new Configuration());
FSDataInputStream inputStream = fs.open(command.path);
Config config = ConfigFactory.parseReader(new InputStreamReader(inputStream, Charset.defaultCharset()));
Preconditions.checkNotNull(config.getObject(SOURCE_KEY));
Preconditions.checkNotNull(config.getObject(DESTINATION_KEY));
DatasetStateStore dstDatasetStateStore = DatasetStateStore.buildDatasetStateStore(config.getConfig(DESTINATION_KEY));
DatasetStateStore srcDatasetStateStore = DatasetStateStore.buildDatasetStateStore(config.getConfig(SOURCE_KEY));
Map<String, JobState.DatasetState> map;
// if migrating state for all jobs then list the store names (job names) and copy the current jst files
if (ConfigUtils.getBoolean(config, MIGRATE_ALL_JOBS, Boolean.valueOf(DEFAULT_MIGRATE_ALL_JOBS))) {
List<String> jobNames = srcDatasetStateStore.getStoreNames(Predicates.alwaysTrue());
for (String jobName : jobNames) {
migrateStateForJob(srcDatasetStateStore, dstDatasetStateStore, jobName, command.deleteSourceStateStore);
}
} else {
Preconditions.checkNotNull(config.getString(JOB_NAME_KEY));
migrateStateForJob(srcDatasetStateStore, dstDatasetStateStore, config.getString(JOB_NAME_KEY), command.deleteSourceStateStore);
}
}
Aggregations