def json_to_ingest_args(json_data): if 'ingest_args' in json_data and 'args_type' in json_data: args_type = json_data['args_type'] ingest_args = json_data['ingest_args'] if args_type == IngestArgs.__name__: return IngestArgs.from_serializable(ingest_args) if args_type == GcsfsIngestArgs.__name__: return GcsfsIngestArgs.from_serializable(ingest_args) logging.error('Unexpected args_type in json_data: %s', args_type) return None
def json_to_cloud_task_args(json_data: dict) -> Optional[CloudTaskArgs]: if "cloud_task_args" in json_data and "args_type" in json_data: args_type = json_data["args_type"] cloud_task_args_dict = json_data["cloud_task_args"] if args_type == IngestArgs.__name__: return IngestArgs.from_serializable(cloud_task_args_dict) if args_type == GcsfsIngestArgs.__name__: return GcsfsIngestArgs.from_serializable(cloud_task_args_dict) if args_type == GcsfsRawDataBQImportArgs.__name__: return GcsfsRawDataBQImportArgs.from_serializable( cloud_task_args_dict) if args_type == GcsfsIngestViewExportArgs.__name__: return GcsfsIngestViewExportArgs.from_serializable( cloud_task_args_dict) logging.error("Unexpected args_type in json_data: %s", args_type) return None
def json_to_cloud_task_args(json_data: dict): if 'cloud_task_args' in json_data and 'args_type' in json_data: args_type = json_data['args_type'] cloud_task_args_dict = json_data['cloud_task_args'] if args_type == IngestArgs.__name__: return IngestArgs.from_serializable(cloud_task_args_dict) if args_type == GcsfsIngestArgs.__name__: return GcsfsIngestArgs.from_serializable(cloud_task_args_dict) if args_type == GcsfsRawDataBQImportArgs.__name__: return GcsfsRawDataBQImportArgs.from_serializable( cloud_task_args_dict) if args_type == GcsfsIngestViewExportArgs.__name__: return GcsfsIngestViewExportArgs.from_serializable( cloud_task_args_dict) logging.error('Unexpected args_type in json_data: %s', args_type) return None