@@ -384,7 +384,7 @@ def _run_annotation_pipeline(known_args, pipeline_args):
384384def _create_sample_info_table (pipeline , # type: beam.Pipeline
385385 pipeline_mode , # type: PipelineModes
386386 known_args , # type: argparse.Namespace,
387- pipeline_args , # type: List[ str]
387+ temp_directory , # str
388388 ):
389389 # type: (...) -> None
390390 headers = pipeline_common .read_headers (
@@ -395,6 +395,7 @@ def _create_sample_info_table(pipeline, # type: beam.Pipeline
395395 _ = (headers | 'SampleInfoToBigQuery' >>
396396 sample_info_to_bigquery .SampleInfoToBigQuery (
397397 known_args .output_table ,
398+ temp_directory ,
398399 known_args .append ,
399400 known_args .samples_span_multiple_files ))
400401
@@ -405,6 +406,8 @@ def run(argv=None):
405406 logging .info ('Command: %s' , ' ' .join (argv or sys .argv ))
406407 known_args , pipeline_args = pipeline_common .parse_args (argv ,
407408 _COMMAND_LINE_OPTIONS )
409+ if known_args .output_table and '--temp_location' not in pipeline_args :
410+ raise ValueError ('--temp_location is required for BigQuery imports.' )
408411 if known_args .auto_flags_experiment :
409412 _get_input_dimensions (known_args , pipeline_args )
410413
@@ -480,8 +483,10 @@ def run(argv=None):
480483 num_partitions = 1
481484
482485 if known_args .output_table :
483- options = pipeline_options .PipelineOptions (pipeline_args )
484- google_cloud_options = options .view_as (pipeline_options .GoogleCloudOptions )
486+ temp_directory = pipeline_options .PipelineOptions (pipeline_args ).view_as (
487+ pipeline_options .GoogleCloudOptions ).temp_location
488+ if not temp_directory :
489+ raise ValueError ('--temp_location must be set when writing to BigQuery.' )
485490 for i in range (num_partitions ):
486491 table_suffix = ''
487492 if partitioner and partitioner .get_partition_name (i ):
@@ -491,7 +496,7 @@ def run(argv=None):
491496 variant_to_bigquery .VariantToBigQuery (
492497 table_name ,
493498 header_fields ,
494- google_cloud_options . temp_location ,
499+ temp_directory ,
495500 variant_merger ,
496501 processed_variant_factory ,
497502 append = known_args .append ,
@@ -502,7 +507,7 @@ def run(argv=None):
502507 known_args .null_numeric_value_replacement )))
503508 if known_args .generate_sample_info_table :
504509 _create_sample_info_table (
505- pipeline , pipeline_mode , known_args , pipeline_args )
510+ pipeline , pipeline_mode , known_args , temp_directory )
506511
507512 if known_args .output_avro_path :
508513 # TODO(bashir2): Add an integration test that outputs to Avro files and
0 commit comments