Let RegistryTool proceed if MetricWriter is unavailable

This may happen with automated runs off Google Cloud.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=213462175
This commit is contained in:
weiminyu 2018-09-18 09:27:40 -07:00 committed by Ben McIlwain
parent b54b1ea9e4
commit 1f80f58336

View file

@ -234,7 +234,12 @@ final class RegistryCli implements AutoCloseable, CommandRunner {
private void runCommand(Command command) throws Exception {
injectReflectively(RegistryToolComponent.class, component, command);
if (metricWriter == null && uploadMetrics) {
metricWriter = component.metricWriter();
try {
metricWriter = component.metricWriter();
} catch (Exception e) {
System.err.format("Failed to get metricWriter. Got error:\n%s\n\n", e);
uploadMetrics = false;
}
}
if (command instanceof CommandWithConnection) {