in transcoder/output/OutputUtil.py [0:0]
def get_output_manager(output_name: str, # pylint: disable=too-many-arguments
output_prefix: str = None,
output_file_path: str = None,
output_encoding: str = None,
prefix_length: int = 2,
destination_project_id: str = None,
destination_dataset_id: str = None,
lazy_create_resources: bool = False,
create_schema_enforcing_topics: bool = True):
"""Returns OutputManager instance based on the supplied name"""
output: OutputManager = None
if output_name == AvroOutputManager.output_type_identifier():
output = AvroOutputManager(output_prefix, output_file_path, lazy_create_resources=lazy_create_resources)
elif output_name == FastAvroOutputManager.output_type_identifier():
output = FastAvroOutputManager(output_prefix, output_file_path, lazy_create_resources=lazy_create_resources)
elif output_name == PubSubOutputManager.output_type_identifier():
output = PubSubOutputManager(destination_project_id, output_encoding=output_encoding,
output_prefix=output_prefix, lazy_create_resources=lazy_create_resources,
create_schema_enforcing_topics=create_schema_enforcing_topics)
elif output_name == BigQueryOutputManager.output_type_identifier():
output = BigQueryOutputManager(destination_project_id, destination_dataset_id, output_prefix,
lazy_create_resources=lazy_create_resources)
elif output_name == BigQueryTerraformOutputManager.output_type_identifier():
output = BigQueryTerraformOutputManager(destination_project_id, destination_dataset_id, output_file_path)
elif output_name == PubSubTerraformOutputManager.output_type_identifier():
output = PubSubTerraformOutputManager(destination_project_id, output_encoding=output_encoding,
create_schema_enforcing_topics=create_schema_enforcing_topics,
output_path=output_file_path)
elif output_name == DiagnosticOutputManager.output_type_identifier():
output = DiagnosticOutputManager()
elif output_name == JsonOutputManager.output_type_identifier():
output = JsonOutputManager(output_prefix, output_file_path, lazy_create_resources=lazy_create_resources)
elif output_name == LengthDelimitedOutputManager.output_type_identifier():
# TODO: pass through output endian specification from CLI args
output = LengthDelimitedOutputManager(prefix_length=prefix_length)
else:
raise UnsupportedOutputTypeError(f'Output {output_name} is not supported')
return output