У меня есть задание oop, которое я пытаюсь запустить в кластере GCP Datapro c. Задание принимает один аргумент, имя файла, которое используется для настройки определенных аспектов задания. Кажется, я не могу найти способ успешно сделать это с CLI gcloud (хотя я могу успешно запустить работу в Airflow). Я пробовал с локальным файлом, файлом в Google Storage и файлом самого кластера.
Вот код из моей работы, который читает в файле:
File inFile = null;
Properties appProps = new Properties();
inFile = new File(args[0]);
try (FileInputStream inFileStream = new FileInputStream(inFile)) {
appProps.load(inFileStream);
} catch (IOException e) {
log.error("Unable to read file");
}
А вот мои попытки запустить команду (где props_test - файл):
# local file
$ gcloud dataproc jobs submit hadoop --project my-project --region global --cluster my-cluster --jar gs://path/to/hadoop_job.jar -- props_test
Job [00653af3afaf40ea8227d5a56e3de458] submitted.
Waiting for job output...
20/01/17 19:29:55 INFO job.JobDriver: props_test
20/01/17 19:29:55 ERROR job.JobDriver: Unable to read file
Exception in thread "main" java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187)
at com.google.common.base.Splitter.split(Splitter.java:371)
at job.JobDriver.parseHadoopConfig(JobDriver.java:52)
at job.JobDriver.run(JobDriver.java:101)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at job.JobDriver.main(JobDriver.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:244)
at org.apache.hadoop.util.RunJar.main(RunJar.java:158)
at com.google.cloud.hadoop.services.agent.job.shim.HadoopRunJarShim.main(HadoopRunJarShim.java:12)
ERROR: (gcloud.dataproc.jobs.submit.hadoop) Job [00653af3afaf40ea8227d5a56e3de458] failed with error:
Job failed with message [Exception in thread "main" java.lang.NullPointerException]. Additional details can be found at '. . .'.
# Google Storage file
$ gcloud dataproc jobs submit hadoop --project my-project --region global --cluster my-cluster --jar gs://path/to/hadoop_job.jar -- gs://path/to/props_test
Job [8ec4a775a0fb4e31b77967d99280fd6c] submitted.
Waiting for job output...
20/01/17 19:30:15 INFO job.JobDriver: gs://path/to/props_test
20/01/17 19:30:15 ERROR job.JobDriver: Unable to read file
Exception in thread "main" java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187)
at com.google.common.base.Splitter.split(Splitter.java:371)
at job.JobDriver.parseHadoopConfig(JobDriver.java:52)
at job.JobDriver.run(JobDriver.java:101)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at job.JobDriver.main(JobDriver.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:244)
at org.apache.hadoop.util.RunJar.main(RunJar.java:158)
at com.google.cloud.hadoop.services.agent.job.shim.HadoopRunJarShim.main(HadoopRunJarShim.java:12)
ERROR: (gcloud.dataproc.jobs.submit.hadoop) Job [8ec4a775a0fb4e31b77967d99280fd6c] failed with error:
Job failed with message [Exception in thread "main" java.lang.NullPointerException]. Additional details can be found at '. . .'.
# File on Dataproc cluster
$ gcloud dataproc jobs submit hadoop --project my-project --region global --cluster my-cluster --jar gs://path/to/hadoop_job.jar -- file:///path/to/props_test
Job [fda035c5159642c294a47385d5ebb85f] submitted.
Waiting for job output...
20/01/17 19:33:23 INFO job.JobDriver: props_test
20/01/17 19:33:23 ERROR job.JobDriver: Unable to read file
Exception in thread "main" java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187)
at com.google.common.base.Splitter.split(Splitter.java:371)
at job.JobDriver.parseHadoopConfig(JobDriver.java:52)
at job.JobDriver.run(JobDriver.java:101)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at job.JobDriver.main(JobDriver.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:244)
at org.apache.hadoop.util.RunJar.main(RunJar.java:158)
at com.google.cloud.hadoop.services.agent.job.shim.HadoopRunJarShim.main(HadoopRunJarShim.java:12)
ERROR: (gcloud.dataproc.jobs.submit.hadoop) Job [fda035c5159642c294a47385d5ebb85f] failed with error:
Job failed with message [Exception in thread "main" java.lang.NullPointerException]. Additional details can be found at '. . .'.