nv-ingest 2025.8.13.dev20250813__py3-none-any.whl → 2025.8.15.dev20250815__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nv-ingest might be problematic. Click here for more details.
- nv_ingest/framework/orchestration/execution/__init__.py +3 -0
- nv_ingest/framework/orchestration/execution/helpers.py +85 -0
- nv_ingest/framework/orchestration/execution/options.py +112 -0
- nv_ingest/framework/orchestration/process/__init__.py +3 -0
- nv_ingest/framework/orchestration/process/dependent_services.py +55 -0
- nv_ingest/framework/orchestration/process/execution.py +497 -0
- nv_ingest/framework/orchestration/process/lifecycle.py +122 -0
- nv_ingest/framework/orchestration/process/strategies.py +182 -0
- nv_ingest/framework/orchestration/ray/examples/pipeline_test_harness.py +1 -1
- nv_ingest/framework/orchestration/ray/primitives/pipeline_topology.py +4 -4
- nv_ingest/framework/orchestration/ray/primitives/ray_pipeline.py +23 -23
- nv_ingest/framework/orchestration/ray/primitives/ray_stat_collector.py +5 -5
- nv_ingest/framework/orchestration/ray/stages/extractors/audio_extractor.py +8 -4
- nv_ingest/framework/orchestration/ray/stages/extractors/chart_extractor.py +16 -16
- nv_ingest/framework/orchestration/ray/stages/extractors/docx_extractor.py +9 -5
- nv_ingest/framework/orchestration/ray/stages/extractors/html_extractor.py +8 -4
- nv_ingest/framework/orchestration/ray/stages/extractors/image_extractor.py +10 -6
- nv_ingest/framework/orchestration/ray/stages/extractors/infographic_extractor.py +22 -10
- nv_ingest/framework/orchestration/ray/stages/extractors/pdf_extractor.py +18 -17
- nv_ingest/framework/orchestration/ray/stages/extractors/pptx_extractor.py +10 -5
- nv_ingest/framework/orchestration/ray/stages/extractors/table_extractor.py +14 -13
- nv_ingest/framework/orchestration/ray/stages/injectors/metadata_injector.py +15 -13
- nv_ingest/framework/orchestration/ray/stages/meta/ray_actor_sink_stage_base.py +3 -0
- nv_ingest/framework/orchestration/ray/stages/meta/ray_actor_source_stage_base.py +3 -3
- nv_ingest/framework/orchestration/ray/stages/meta/ray_actor_stage_base.py +22 -13
- nv_ingest/framework/orchestration/ray/stages/mutate/image_dedup.py +10 -7
- nv_ingest/framework/orchestration/ray/stages/mutate/image_filter.py +10 -8
- nv_ingest/framework/orchestration/ray/stages/sinks/default_drain.py +4 -4
- nv_ingest/framework/orchestration/ray/stages/sinks/message_broker_task_sink.py +5 -2
- nv_ingest/framework/orchestration/ray/stages/sources/message_broker_task_source.py +71 -61
- nv_ingest/framework/orchestration/ray/stages/storage/image_storage.py +7 -5
- nv_ingest/framework/orchestration/ray/stages/storage/store_embeddings.py +8 -4
- nv_ingest/framework/orchestration/ray/stages/telemetry/job_counter.py +8 -4
- nv_ingest/framework/orchestration/ray/stages/telemetry/otel_tracer.py +17 -7
- nv_ingest/framework/orchestration/ray/stages/transforms/image_caption.py +7 -5
- nv_ingest/framework/orchestration/ray/stages/transforms/text_embed.py +13 -14
- nv_ingest/framework/orchestration/ray/stages/transforms/text_splitter.py +18 -12
- nv_ingest/framework/orchestration/ray/stages/utility/throughput_monitor.py +11 -3
- nv_ingest/framework/orchestration/ray/util/pipeline/pid_controller.py +1 -2
- nv_ingest/framework/orchestration/ray/util/pipeline/pipeline_runners.py +33 -326
- nv_ingest/framework/orchestration/ray/util/pipeline/tools.py +13 -3
- nv_ingest/framework/util/flow_control/udf_intercept.py +352 -0
- nv_ingest/pipeline/__init__.py +3 -0
- nv_ingest/pipeline/config/__init__.py +3 -0
- nv_ingest/pipeline/config/loaders.py +198 -0
- nv_ingest/pipeline/config/replica_resolver.py +227 -0
- nv_ingest/pipeline/default_pipeline_impl.py +517 -0
- nv_ingest/pipeline/ingest_pipeline.py +389 -0
- nv_ingest/pipeline/pipeline_schema.py +398 -0
- {nv_ingest-2025.8.13.dev20250813.dist-info → nv_ingest-2025.8.15.dev20250815.dist-info}/METADATA +1 -1
- {nv_ingest-2025.8.13.dev20250813.dist-info → nv_ingest-2025.8.15.dev20250815.dist-info}/RECORD +54 -40
- nv_ingest/framework/orchestration/ray/util/pipeline/pipeline_builders.py +0 -359
- nv_ingest/framework/orchestration/ray/util/pipeline/stage_builders.py +0 -649
- {nv_ingest-2025.8.13.dev20250813.dist-info → nv_ingest-2025.8.15.dev20250815.dist-info}/WHEEL +0 -0
- {nv_ingest-2025.8.13.dev20250813.dist-info → nv_ingest-2025.8.15.dev20250815.dist-info}/licenses/LICENSE +0 -0
- {nv_ingest-2025.8.13.dev20250813.dist-info → nv_ingest-2025.8.15.dev20250815.dist-info}/top_level.txt +0 -0
|
@@ -1,359 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-25, NVIDIA CORPORATION & AFFILIATES.
|
|
2
|
-
# All rights reserved.
|
|
3
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
|
|
5
|
-
import json
|
|
6
|
-
import logging
|
|
7
|
-
import math
|
|
8
|
-
import os
|
|
9
|
-
from typing import Dict, Any
|
|
10
|
-
|
|
11
|
-
import ray
|
|
12
|
-
from ray import LoggingConfig
|
|
13
|
-
from pydantic import BaseModel
|
|
14
|
-
|
|
15
|
-
from nv_ingest.framework.orchestration.ray.primitives.ray_pipeline import RayPipeline
|
|
16
|
-
from nv_ingest.framework.orchestration.ray.util.pipeline.stage_builders import (
|
|
17
|
-
add_source_stage,
|
|
18
|
-
add_metadata_injector_stage,
|
|
19
|
-
add_pdf_extractor_stage,
|
|
20
|
-
add_image_extractor_stage,
|
|
21
|
-
add_docx_extractor_stage,
|
|
22
|
-
add_audio_extractor_stage,
|
|
23
|
-
add_html_extractor_stage,
|
|
24
|
-
add_image_dedup_stage,
|
|
25
|
-
add_image_filter_stage,
|
|
26
|
-
add_table_extractor_stage,
|
|
27
|
-
add_chart_extractor_stage,
|
|
28
|
-
add_image_caption_stage,
|
|
29
|
-
add_text_splitter_stage,
|
|
30
|
-
add_text_embedding_stage,
|
|
31
|
-
add_embedding_storage_stage,
|
|
32
|
-
add_image_storage_stage,
|
|
33
|
-
add_message_broker_response_stage,
|
|
34
|
-
add_pptx_extractor_stage,
|
|
35
|
-
add_infographic_extractor_stage,
|
|
36
|
-
add_otel_tracer_stage,
|
|
37
|
-
add_default_drain_stage,
|
|
38
|
-
)
|
|
39
|
-
from nv_ingest_api.util.system.hardware_info import SystemResourceProbe
|
|
40
|
-
|
|
41
|
-
logger = logging.getLogger("uvicorn")
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def export_config_to_env(ingest_config: Any) -> None:
|
|
45
|
-
if isinstance(ingest_config, BaseModel):
|
|
46
|
-
ingest_config = ingest_config.model_dump()
|
|
47
|
-
|
|
48
|
-
os.environ.update({key.upper(): val for key, val in ingest_config.items()})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def build_logging_config_from_env() -> LoggingConfig:
|
|
52
|
-
"""
|
|
53
|
-
Build Ray LoggingConfig from environment variables.
|
|
54
|
-
|
|
55
|
-
Package-level preset (sets all defaults):
|
|
56
|
-
- INGEST_RAY_LOG_LEVEL: PRODUCTION, DEVELOPMENT, DEBUG. Default: DEVELOPMENT
|
|
57
|
-
|
|
58
|
-
Individual environment variables (override preset defaults):
|
|
59
|
-
- RAY_LOGGING_LEVEL: Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL). Default: INFO
|
|
60
|
-
- RAY_LOGGING_ENCODING: Log encoding format (TEXT, JSON). Default: TEXT
|
|
61
|
-
- RAY_LOGGING_ADDITIONAL_ATTRS: Comma-separated list of additional standard logger attributes
|
|
62
|
-
- RAY_DEDUP_LOGS: Enable/disable log deduplication (0/1). Default: 1 (enabled)
|
|
63
|
-
- RAY_LOG_TO_DRIVER: Enable/disable logging to driver (true/false). Default: true
|
|
64
|
-
- RAY_LOGGING_ROTATE_BYTES: Maximum log file size before rotation (bytes). Default: 1GB
|
|
65
|
-
- RAY_LOGGING_ROTATE_BACKUP_COUNT: Number of backup log files to keep. Default: 19
|
|
66
|
-
- RAY_DISABLE_IMPORT_WARNING: Disable Ray import warnings (0/1). Default: 0
|
|
67
|
-
- RAY_USAGE_STATS_ENABLED: Enable/disable usage stats collection (0/1). Default: 1
|
|
68
|
-
"""
|
|
69
|
-
|
|
70
|
-
# Apply package-level preset defaults first
|
|
71
|
-
preset_level = os.environ.get("INGEST_RAY_LOG_LEVEL", "DEVELOPMENT").upper()
|
|
72
|
-
|
|
73
|
-
# Define preset configurations
|
|
74
|
-
presets = {
|
|
75
|
-
"PRODUCTION": {
|
|
76
|
-
"RAY_LOGGING_LEVEL": "ERROR",
|
|
77
|
-
"RAY_LOGGING_ENCODING": "TEXT",
|
|
78
|
-
"RAY_LOGGING_ADDITIONAL_ATTRS": "",
|
|
79
|
-
"RAY_DEDUP_LOGS": "1",
|
|
80
|
-
"RAY_LOG_TO_DRIVER": "0", # false
|
|
81
|
-
"RAY_LOGGING_ROTATE_BYTES": "1073741824", # 1GB
|
|
82
|
-
"RAY_LOGGING_ROTATE_BACKUP_COUNT": "9", # 10GB total
|
|
83
|
-
"RAY_DISABLE_IMPORT_WARNING": "1",
|
|
84
|
-
"RAY_USAGE_STATS_ENABLED": "0",
|
|
85
|
-
},
|
|
86
|
-
"DEVELOPMENT": {
|
|
87
|
-
"RAY_LOGGING_LEVEL": "INFO",
|
|
88
|
-
"RAY_LOGGING_ENCODING": "TEXT",
|
|
89
|
-
"RAY_LOGGING_ADDITIONAL_ATTRS": "",
|
|
90
|
-
"RAY_DEDUP_LOGS": "1",
|
|
91
|
-
"RAY_LOG_TO_DRIVER": "1", # true
|
|
92
|
-
"RAY_LOGGING_ROTATE_BYTES": "1073741824", # 1GB
|
|
93
|
-
"RAY_LOGGING_ROTATE_BACKUP_COUNT": "19", # 20GB total
|
|
94
|
-
"RAY_DISABLE_IMPORT_WARNING": "0",
|
|
95
|
-
"RAY_USAGE_STATS_ENABLED": "1",
|
|
96
|
-
},
|
|
97
|
-
"DEBUG": {
|
|
98
|
-
"RAY_LOGGING_LEVEL": "DEBUG",
|
|
99
|
-
"RAY_LOGGING_ENCODING": "JSON",
|
|
100
|
-
"RAY_LOGGING_ADDITIONAL_ATTRS": "name,funcName,lineno",
|
|
101
|
-
"RAY_DEDUP_LOGS": "0",
|
|
102
|
-
"RAY_LOG_TO_DRIVER": "1", # true
|
|
103
|
-
"RAY_LOGGING_ROTATE_BYTES": "536870912", # 512MB
|
|
104
|
-
"RAY_LOGGING_ROTATE_BACKUP_COUNT": "39", # 20GB total
|
|
105
|
-
"RAY_DISABLE_IMPORT_WARNING": "0",
|
|
106
|
-
"RAY_USAGE_STATS_ENABLED": "1",
|
|
107
|
-
},
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
# Validate preset level
|
|
111
|
-
if preset_level not in presets:
|
|
112
|
-
logger.warning(
|
|
113
|
-
f"Invalid INGEST_RAY_LOG_LEVEL '{preset_level}', using DEVELOPMENT. "
|
|
114
|
-
f"Valid presets: {list(presets.keys())}"
|
|
115
|
-
)
|
|
116
|
-
preset_level = "DEVELOPMENT"
|
|
117
|
-
|
|
118
|
-
# Apply preset defaults (only if env var not already set)
|
|
119
|
-
preset_config = presets[preset_level]
|
|
120
|
-
for key, default_value in preset_config.items():
|
|
121
|
-
if key not in os.environ:
|
|
122
|
-
os.environ[key] = default_value
|
|
123
|
-
|
|
124
|
-
logger.info(f"Applied Ray logging preset: {preset_level}")
|
|
125
|
-
|
|
126
|
-
# Get log level from environment, default to INFO
|
|
127
|
-
log_level = os.environ.get("RAY_LOGGING_LEVEL", "INFO").upper()
|
|
128
|
-
|
|
129
|
-
# Validate log level
|
|
130
|
-
valid_levels = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
|
|
131
|
-
if log_level not in valid_levels:
|
|
132
|
-
logger.warning(f"Invalid RAY_LOGGING_LEVEL '{log_level}', using INFO. Valid levels: {valid_levels}")
|
|
133
|
-
log_level = "INFO"
|
|
134
|
-
|
|
135
|
-
# Get encoding format from environment, default to TEXT
|
|
136
|
-
encoding = os.environ.get("RAY_LOGGING_ENCODING", "TEXT").upper()
|
|
137
|
-
|
|
138
|
-
# Validate encoding
|
|
139
|
-
valid_encodings = ["TEXT", "JSON"]
|
|
140
|
-
if encoding not in valid_encodings:
|
|
141
|
-
logger.warning(f"Invalid RAY_LOGGING_ENCODING '{encoding}', using TEXT. Valid encodings: {valid_encodings}")
|
|
142
|
-
encoding = "TEXT"
|
|
143
|
-
|
|
144
|
-
# Get additional standard logger attributes
|
|
145
|
-
additional_attrs_str = os.environ.get("RAY_LOGGING_ADDITIONAL_ATTRS", "")
|
|
146
|
-
additional_log_standard_attrs = []
|
|
147
|
-
if additional_attrs_str:
|
|
148
|
-
additional_log_standard_attrs = [attr.strip() for attr in additional_attrs_str.split(",") if attr.strip()]
|
|
149
|
-
|
|
150
|
-
# Set log deduplication environment variable if specified
|
|
151
|
-
dedup_logs = os.environ.get("RAY_DEDUP_LOGS", "1")
|
|
152
|
-
if dedup_logs is not None:
|
|
153
|
-
os.environ["RAY_DEDUP_LOGS"] = str(dedup_logs)
|
|
154
|
-
|
|
155
|
-
# Set log to driver environment variable if specified
|
|
156
|
-
log_to_driver = os.environ.get("RAY_LOG_TO_DRIVER", "1")
|
|
157
|
-
if log_to_driver is not None:
|
|
158
|
-
os.environ["RAY_LOG_TO_DRIVER"] = str(log_to_driver).lower()
|
|
159
|
-
|
|
160
|
-
# Configure log rotation settings
|
|
161
|
-
rotate_bytes = os.environ.get("RAY_LOGGING_ROTATE_BYTES", "1073741824") # Default: 1GB per file
|
|
162
|
-
if rotate_bytes is not None:
|
|
163
|
-
try:
|
|
164
|
-
rotate_bytes_int = int(rotate_bytes)
|
|
165
|
-
os.environ["RAY_LOGGING_ROTATE_BYTES"] = str(rotate_bytes_int)
|
|
166
|
-
except ValueError:
|
|
167
|
-
logger.warning(f"Invalid RAY_LOGGING_ROTATE_BYTES '{rotate_bytes}', using default (1GB)")
|
|
168
|
-
os.environ["RAY_LOGGING_ROTATE_BYTES"] = "1073741824"
|
|
169
|
-
|
|
170
|
-
rotate_backup_count = os.environ.get("RAY_LOGGING_ROTATE_BACKUP_COUNT", "19") # Default: 19 backups (20GB Max)
|
|
171
|
-
if rotate_backup_count is not None:
|
|
172
|
-
try:
|
|
173
|
-
backup_count_int = int(rotate_backup_count)
|
|
174
|
-
os.environ["RAY_LOGGING_ROTATE_BACKUP_COUNT"] = str(backup_count_int)
|
|
175
|
-
except ValueError:
|
|
176
|
-
logger.warning(f"Invalid RAY_LOGGING_ROTATE_BACKUP_COUNT '{rotate_backup_count}', using default (19)")
|
|
177
|
-
os.environ["RAY_LOGGING_ROTATE_BACKUP_COUNT"] = "19"
|
|
178
|
-
|
|
179
|
-
# Configure Ray internal logging verbosity
|
|
180
|
-
disable_import_warning = os.environ.get("RAY_DISABLE_IMPORT_WARNING", "0")
|
|
181
|
-
if disable_import_warning is not None:
|
|
182
|
-
os.environ["RAY_DISABLE_IMPORT_WARNING"] = str(disable_import_warning)
|
|
183
|
-
|
|
184
|
-
# Configure usage stats collection
|
|
185
|
-
usage_stats_enabled = os.environ.get("RAY_USAGE_STATS_ENABLED", "1")
|
|
186
|
-
if usage_stats_enabled is not None:
|
|
187
|
-
os.environ["RAY_USAGE_STATS_ENABLED"] = str(usage_stats_enabled)
|
|
188
|
-
|
|
189
|
-
# Create LoggingConfig with validated parameters
|
|
190
|
-
logging_config = LoggingConfig(
|
|
191
|
-
encoding=encoding,
|
|
192
|
-
log_level=log_level,
|
|
193
|
-
additional_log_standard_attrs=additional_log_standard_attrs,
|
|
194
|
-
)
|
|
195
|
-
|
|
196
|
-
logger.info(
|
|
197
|
-
f"Ray logging configured: preset={preset_level}, level={log_level}, encoding={encoding}, "
|
|
198
|
-
f"additional_attrs={additional_log_standard_attrs}, "
|
|
199
|
-
f"dedup_logs={os.environ.get('RAY_DEDUP_LOGS', '1')}, "
|
|
200
|
-
f"log_to_driver={os.environ.get('RAY_LOG_TO_DRIVER', 'true')}, "
|
|
201
|
-
f"rotate_bytes={os.environ.get('RAY_LOGGING_ROTATE_BYTES', '1073741824')}, "
|
|
202
|
-
f"rotate_backup_count={os.environ.get('RAY_LOGGING_ROTATE_BACKUP_COUNT', '19')}"
|
|
203
|
-
)
|
|
204
|
-
|
|
205
|
-
return logging_config
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
def setup_ingestion_pipeline(pipeline: RayPipeline, ingest_config: Dict[str, Any] = None):
|
|
209
|
-
# Initialize the pipeline with the configuration
|
|
210
|
-
if ingest_config:
|
|
211
|
-
# Export the config to environment variables
|
|
212
|
-
export_config_to_env(ingest_config)
|
|
213
|
-
|
|
214
|
-
_ = logging.getLogger().getEffectiveLevel()
|
|
215
|
-
logging_config = build_logging_config_from_env()
|
|
216
|
-
ray_context = ray.init(
|
|
217
|
-
namespace="nv_ingest_ray",
|
|
218
|
-
logging_config=logging_config,
|
|
219
|
-
ignore_reinit_error=True,
|
|
220
|
-
dashboard_host="0.0.0.0",
|
|
221
|
-
dashboard_port=8265,
|
|
222
|
-
_system_config={
|
|
223
|
-
"local_fs_capacity_threshold": 0.9,
|
|
224
|
-
"object_spilling_config": json.dumps(
|
|
225
|
-
{
|
|
226
|
-
"type": "filesystem",
|
|
227
|
-
"params": {
|
|
228
|
-
"directory_path": [
|
|
229
|
-
"/tmp/ray_spill_testing_0",
|
|
230
|
-
"/tmp/ray_spill_testing_1",
|
|
231
|
-
"/tmp/ray_spill_testing_2",
|
|
232
|
-
"/tmp/ray_spill_testing_3",
|
|
233
|
-
],
|
|
234
|
-
"buffer_size": 100_000_000,
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
),
|
|
238
|
-
},
|
|
239
|
-
)
|
|
240
|
-
system_resource_probe = SystemResourceProbe()
|
|
241
|
-
|
|
242
|
-
effective_cpu_core_count = system_resource_probe.get_effective_cores()
|
|
243
|
-
default_cpu_count = int(os.environ.get("NV_INGEST_MAX_UTIL", int(max(1, math.floor(effective_cpu_core_count)))))
|
|
244
|
-
|
|
245
|
-
add_meter_stage = os.environ.get("MESSAGE_CLIENT_TYPE") != "simple"
|
|
246
|
-
_ = add_meter_stage # TODO(Devin)
|
|
247
|
-
|
|
248
|
-
########################################################################################################
|
|
249
|
-
## Insertion and Pre-processing stages
|
|
250
|
-
########################################################################################################
|
|
251
|
-
logger.debug("Setting up ingestion pipeline")
|
|
252
|
-
source_stage_id = add_source_stage(pipeline, default_cpu_count)
|
|
253
|
-
# TODO(Devin): Job counter used a global stats object that isn't ray compatible, need to update.
|
|
254
|
-
# submitted_job_counter_stage = add_submitted_job_counter_stage(pipe, morpheus_pipeline_config, ingest_config)
|
|
255
|
-
metadata_injector_stage_id = add_metadata_injector_stage(pipeline, default_cpu_count)
|
|
256
|
-
########################################################################################################
|
|
257
|
-
|
|
258
|
-
########################################################################################################
|
|
259
|
-
## Primitive extraction
|
|
260
|
-
########################################################################################################
|
|
261
|
-
pdf_extractor_stage_id = add_pdf_extractor_stage(pipeline, default_cpu_count)
|
|
262
|
-
image_extractor_stage_id = add_image_extractor_stage(pipeline, default_cpu_count)
|
|
263
|
-
docx_extractor_stage_id = add_docx_extractor_stage(pipeline, default_cpu_count)
|
|
264
|
-
pptx_extractor_stage_id = add_pptx_extractor_stage(pipeline, default_cpu_count)
|
|
265
|
-
audio_extractor_stage_id = add_audio_extractor_stage(pipeline, default_cpu_count)
|
|
266
|
-
html_extractor_stage_id = add_html_extractor_stage(pipeline, default_cpu_count)
|
|
267
|
-
########################################################################################################
|
|
268
|
-
|
|
269
|
-
########################################################################################################
|
|
270
|
-
## Post-processing
|
|
271
|
-
########################################################################################################
|
|
272
|
-
image_dedup_stage_id = add_image_dedup_stage(pipeline, default_cpu_count)
|
|
273
|
-
image_filter_stage_id = add_image_filter_stage(pipeline, default_cpu_count)
|
|
274
|
-
table_extraction_stage_id = add_table_extractor_stage(pipeline, default_cpu_count)
|
|
275
|
-
chart_extraction_stage_id = add_chart_extractor_stage(pipeline, default_cpu_count)
|
|
276
|
-
infographic_extraction_stage_id = add_infographic_extractor_stage(pipeline, default_cpu_count)
|
|
277
|
-
image_caption_stage_id = add_image_caption_stage(pipeline, default_cpu_count)
|
|
278
|
-
########################################################################################################
|
|
279
|
-
|
|
280
|
-
########################################################################################################
|
|
281
|
-
## Transforms and data synthesis
|
|
282
|
-
########################################################################################################
|
|
283
|
-
text_splitter_stage_id = add_text_splitter_stage(pipeline, default_cpu_count)
|
|
284
|
-
embed_extractions_stage_id = add_text_embedding_stage(pipeline, default_cpu_count)
|
|
285
|
-
|
|
286
|
-
########################################################################################################
|
|
287
|
-
## Storage and output
|
|
288
|
-
########################################################################################################
|
|
289
|
-
embedding_storage_stage_id = add_embedding_storage_stage(pipeline, default_cpu_count)
|
|
290
|
-
image_storage_stage_id = add_image_storage_stage(pipeline, default_cpu_count)
|
|
291
|
-
# vdb_task_sink_stage = add_vdb_task_sink_stage(pipe, morpheus_pipeline_config, ingest_config)
|
|
292
|
-
broker_response_stage_id = add_message_broker_response_stage(pipeline, default_cpu_count)
|
|
293
|
-
########################################################################################################
|
|
294
|
-
|
|
295
|
-
#######################################################################################################
|
|
296
|
-
## Telemetry (Note: everything after the sync stage is out of the hot path, please keep it that way) ##
|
|
297
|
-
#######################################################################################################
|
|
298
|
-
otel_tracer_stage_id = add_otel_tracer_stage(pipeline, default_cpu_count)
|
|
299
|
-
|
|
300
|
-
# TODO(devin)
|
|
301
|
-
# if add_meter_stage:
|
|
302
|
-
# otel_meter_stage = add_otel_meter_stage(pipe, morpheus_pipeline_config, ingest_config)
|
|
303
|
-
# else:
|
|
304
|
-
# otel_meter_stage = None
|
|
305
|
-
# completed_job_counter_stage = add_completed_job_counter_stage(pipe, morpheus_pipeline_config, ingest_config)
|
|
306
|
-
########################################################################################################
|
|
307
|
-
|
|
308
|
-
# Add a drain stage to the pipeline -- flushes and deletes control messages
|
|
309
|
-
drain_id = add_default_drain_stage(pipeline, default_cpu_count)
|
|
310
|
-
|
|
311
|
-
ingest_edge_buffer_size = int(os.environ.get("INGEST_EDGE_BUFFER_SIZE", 32))
|
|
312
|
-
|
|
313
|
-
# Add edges
|
|
314
|
-
###### Intake Stages ########
|
|
315
|
-
pipeline.make_edge(source_stage_id, metadata_injector_stage_id, queue_size=ingest_edge_buffer_size)
|
|
316
|
-
pipeline.make_edge(metadata_injector_stage_id, pdf_extractor_stage_id, queue_size=ingest_edge_buffer_size)
|
|
317
|
-
|
|
318
|
-
###### Document Extractors ########
|
|
319
|
-
pipeline.make_edge(pdf_extractor_stage_id, audio_extractor_stage_id, queue_size=ingest_edge_buffer_size)
|
|
320
|
-
pipeline.make_edge(audio_extractor_stage_id, docx_extractor_stage_id, queue_size=ingest_edge_buffer_size)
|
|
321
|
-
pipeline.make_edge(docx_extractor_stage_id, pptx_extractor_stage_id, queue_size=ingest_edge_buffer_size)
|
|
322
|
-
pipeline.make_edge(pptx_extractor_stage_id, image_extractor_stage_id, queue_size=ingest_edge_buffer_size)
|
|
323
|
-
pipeline.make_edge(image_extractor_stage_id, html_extractor_stage_id, queue_size=ingest_edge_buffer_size)
|
|
324
|
-
pipeline.make_edge(html_extractor_stage_id, infographic_extraction_stage_id, queue_size=ingest_edge_buffer_size)
|
|
325
|
-
|
|
326
|
-
###### Primitive Extractors ########
|
|
327
|
-
pipeline.make_edge(infographic_extraction_stage_id, table_extraction_stage_id, queue_size=ingest_edge_buffer_size)
|
|
328
|
-
pipeline.make_edge(table_extraction_stage_id, chart_extraction_stage_id, queue_size=ingest_edge_buffer_size)
|
|
329
|
-
pipeline.make_edge(chart_extraction_stage_id, image_filter_stage_id, queue_size=ingest_edge_buffer_size)
|
|
330
|
-
|
|
331
|
-
###### Primitive Mutators ########
|
|
332
|
-
pipeline.make_edge(image_filter_stage_id, image_dedup_stage_id, queue_size=ingest_edge_buffer_size)
|
|
333
|
-
pipeline.make_edge(image_dedup_stage_id, text_splitter_stage_id, queue_size=ingest_edge_buffer_size)
|
|
334
|
-
|
|
335
|
-
###### Primitive Transforms ########
|
|
336
|
-
pipeline.make_edge(text_splitter_stage_id, image_caption_stage_id, queue_size=ingest_edge_buffer_size)
|
|
337
|
-
pipeline.make_edge(image_caption_stage_id, embed_extractions_stage_id, queue_size=ingest_edge_buffer_size)
|
|
338
|
-
pipeline.make_edge(embed_extractions_stage_id, image_storage_stage_id, queue_size=ingest_edge_buffer_size)
|
|
339
|
-
|
|
340
|
-
###### Primitive Storage ########
|
|
341
|
-
pipeline.make_edge(image_storage_stage_id, embedding_storage_stage_id, queue_size=ingest_edge_buffer_size)
|
|
342
|
-
pipeline.make_edge(embedding_storage_stage_id, broker_response_stage_id, queue_size=ingest_edge_buffer_size)
|
|
343
|
-
|
|
344
|
-
###### Response and Telemetry ########
|
|
345
|
-
pipeline.make_edge(broker_response_stage_id, otel_tracer_stage_id, queue_size=ingest_edge_buffer_size)
|
|
346
|
-
pipeline.make_edge(otel_tracer_stage_id, drain_id, queue_size=ingest_edge_buffer_size)
|
|
347
|
-
|
|
348
|
-
pipeline.build()
|
|
349
|
-
|
|
350
|
-
# TODO(devin)
|
|
351
|
-
# if add_meter_stage:
|
|
352
|
-
# pipe.add_edge(sink_stage, otel_meter_stage)
|
|
353
|
-
# pipe.add_edge(otel_meter_stage, otel_tracer_stage)
|
|
354
|
-
# else:
|
|
355
|
-
# pipe.add_edge(sink_stage, otel_tracer_stage)
|
|
356
|
-
|
|
357
|
-
# pipe.add_edge(otel_tracer_stage, completed_job_counter_stage)
|
|
358
|
-
|
|
359
|
-
return ray_context
|