fractor 0.1.4 → 0.1.7
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.
- checksums.yaml +4 -4
- data/.rubocop-https---raw-githubusercontent-com-riboseinc-oss-guides-main-ci-rubocop-yml +552 -0
- data/.rubocop.yml +14 -8
- data/.rubocop_todo.yml +284 -43
- data/README.adoc +111 -950
- data/docs/.lycheeignore +16 -0
- data/docs/Gemfile +24 -0
- data/docs/README.md +157 -0
- data/docs/_config.yml +151 -0
- data/docs/_features/error-handling.adoc +1192 -0
- data/docs/_features/index.adoc +80 -0
- data/docs/_features/monitoring.adoc +589 -0
- data/docs/_features/signal-handling.adoc +202 -0
- data/docs/_features/workflows.adoc +1235 -0
- data/docs/_guides/continuous-mode.adoc +736 -0
- data/docs/_guides/cookbook.adoc +1133 -0
- data/docs/_guides/index.adoc +55 -0
- data/docs/_guides/pipeline-mode.adoc +730 -0
- data/docs/_guides/troubleshooting.adoc +358 -0
- data/docs/_pages/architecture.adoc +1390 -0
- data/docs/_pages/core-concepts.adoc +1392 -0
- data/docs/_pages/design-principles.adoc +862 -0
- data/docs/_pages/getting-started.adoc +290 -0
- data/docs/_pages/installation.adoc +143 -0
- data/docs/_reference/api.adoc +1080 -0
- data/docs/_reference/error-reporting.adoc +670 -0
- data/docs/_reference/examples.adoc +181 -0
- data/docs/_reference/index.adoc +96 -0
- data/docs/_reference/troubleshooting.adoc +862 -0
- data/docs/_tutorials/complex-workflows.adoc +1022 -0
- data/docs/_tutorials/data-processing-pipeline.adoc +740 -0
- data/docs/_tutorials/first-application.adoc +384 -0
- data/docs/_tutorials/index.adoc +48 -0
- data/docs/_tutorials/long-running-services.adoc +931 -0
- data/docs/assets/images/favicon-16.png +0 -0
- data/docs/assets/images/favicon-32.png +0 -0
- data/docs/assets/images/favicon-48.png +0 -0
- data/docs/assets/images/favicon.ico +0 -0
- data/docs/assets/images/favicon.png +0 -0
- data/docs/assets/images/favicon.svg +45 -0
- data/docs/assets/images/fractor-icon.svg +49 -0
- data/docs/assets/images/fractor-logo.svg +61 -0
- data/docs/index.adoc +131 -0
- data/docs/lychee.toml +39 -0
- data/examples/api_aggregator/README.adoc +627 -0
- data/examples/api_aggregator/api_aggregator.rb +376 -0
- data/examples/auto_detection/README.adoc +407 -29
- data/examples/auto_detection/auto_detection.rb +9 -9
- data/examples/continuous_chat_common/message_protocol.rb +53 -0
- data/examples/continuous_chat_fractor/README.adoc +217 -0
- data/examples/continuous_chat_fractor/chat_client.rb +303 -0
- data/examples/continuous_chat_fractor/chat_common.rb +83 -0
- data/examples/continuous_chat_fractor/chat_server.rb +167 -0
- data/examples/continuous_chat_fractor/simulate.rb +345 -0
- data/examples/continuous_chat_server/README.adoc +135 -0
- data/examples/continuous_chat_server/chat_client.rb +303 -0
- data/examples/continuous_chat_server/chat_server.rb +359 -0
- data/examples/continuous_chat_server/simulate.rb +343 -0
- data/examples/error_reporting.rb +207 -0
- data/examples/file_processor/README.adoc +170 -0
- data/examples/file_processor/file_processor.rb +615 -0
- data/examples/file_processor/sample_files/invalid.csv +1 -0
- data/examples/file_processor/sample_files/orders.xml +24 -0
- data/examples/file_processor/sample_files/products.json +23 -0
- data/examples/file_processor/sample_files/users.csv +6 -0
- data/examples/hierarchical_hasher/README.adoc +629 -41
- data/examples/hierarchical_hasher/hierarchical_hasher.rb +12 -8
- data/examples/image_processor/README.adoc +610 -0
- data/examples/image_processor/image_processor.rb +349 -0
- data/examples/image_processor/processed_images/sample_10_processed.jpg.json +12 -0
- data/examples/image_processor/processed_images/sample_1_processed.jpg.json +12 -0
- data/examples/image_processor/processed_images/sample_2_processed.jpg.json +12 -0
- data/examples/image_processor/processed_images/sample_3_processed.jpg.json +12 -0
- data/examples/image_processor/processed_images/sample_4_processed.jpg.json +12 -0
- data/examples/image_processor/processed_images/sample_5_processed.jpg.json +12 -0
- data/examples/image_processor/processed_images/sample_6_processed.jpg.json +12 -0
- data/examples/image_processor/processed_images/sample_7_processed.jpg.json +12 -0
- data/examples/image_processor/processed_images/sample_8_processed.jpg.json +12 -0
- data/examples/image_processor/processed_images/sample_9_processed.jpg.json +12 -0
- data/examples/image_processor/test_images/sample_1.png +1 -0
- data/examples/image_processor/test_images/sample_10.png +1 -0
- data/examples/image_processor/test_images/sample_2.png +1 -0
- data/examples/image_processor/test_images/sample_3.png +1 -0
- data/examples/image_processor/test_images/sample_4.png +1 -0
- data/examples/image_processor/test_images/sample_5.png +1 -0
- data/examples/image_processor/test_images/sample_6.png +1 -0
- data/examples/image_processor/test_images/sample_7.png +1 -0
- data/examples/image_processor/test_images/sample_8.png +1 -0
- data/examples/image_processor/test_images/sample_9.png +1 -0
- data/examples/log_analyzer/README.adoc +662 -0
- data/examples/log_analyzer/log_analyzer.rb +579 -0
- data/examples/log_analyzer/sample_logs/apache.log +20 -0
- data/examples/log_analyzer/sample_logs/json.log +15 -0
- data/examples/log_analyzer/sample_logs/nginx.log +15 -0
- data/examples/log_analyzer/sample_logs/rails.log +29 -0
- data/examples/multi_work_type/README.adoc +576 -26
- data/examples/multi_work_type/multi_work_type.rb +30 -29
- data/examples/performance_monitoring.rb +120 -0
- data/examples/pipeline_processing/README.adoc +740 -26
- data/examples/pipeline_processing/pipeline_processing.rb +16 -16
- data/examples/priority_work_example.rb +155 -0
- data/examples/producer_subscriber/README.adoc +889 -46
- data/examples/producer_subscriber/producer_subscriber.rb +20 -16
- data/examples/scatter_gather/README.adoc +829 -27
- data/examples/scatter_gather/scatter_gather.rb +29 -28
- data/examples/simple/README.adoc +347 -0
- data/examples/simple/sample.rb +5 -5
- data/examples/specialized_workers/README.adoc +622 -26
- data/examples/specialized_workers/specialized_workers.rb +88 -45
- data/examples/stream_processor/README.adoc +206 -0
- data/examples/stream_processor/stream_processor.rb +284 -0
- data/examples/web_scraper/README.adoc +625 -0
- data/examples/web_scraper/web_scraper.rb +285 -0
- data/examples/workflow/README.adoc +406 -0
- data/examples/workflow/circuit_breaker/README.adoc +360 -0
- data/examples/workflow/circuit_breaker/circuit_breaker_workflow.rb +225 -0
- data/examples/workflow/conditional/README.adoc +483 -0
- data/examples/workflow/conditional/conditional_workflow.rb +215 -0
- data/examples/workflow/dead_letter_queue/README.adoc +374 -0
- data/examples/workflow/dead_letter_queue/dead_letter_queue_workflow.rb +217 -0
- data/examples/workflow/fan_out/README.adoc +381 -0
- data/examples/workflow/fan_out/fan_out_workflow.rb +202 -0
- data/examples/workflow/retry/README.adoc +248 -0
- data/examples/workflow/retry/retry_workflow.rb +195 -0
- data/examples/workflow/simple_linear/README.adoc +267 -0
- data/examples/workflow/simple_linear/simple_linear_workflow.rb +175 -0
- data/examples/workflow/simplified/README.adoc +329 -0
- data/examples/workflow/simplified/simplified_workflow.rb +222 -0
- data/exe/fractor +10 -0
- data/lib/fractor/cli.rb +288 -0
- data/lib/fractor/configuration.rb +307 -0
- data/lib/fractor/continuous_server.rb +183 -0
- data/lib/fractor/error_formatter.rb +72 -0
- data/lib/fractor/error_report_generator.rb +152 -0
- data/lib/fractor/error_reporter.rb +244 -0
- data/lib/fractor/error_statistics.rb +147 -0
- data/lib/fractor/execution_tracer.rb +162 -0
- data/lib/fractor/logger.rb +230 -0
- data/lib/fractor/main_loop_handler.rb +406 -0
- data/lib/fractor/main_loop_handler3.rb +135 -0
- data/lib/fractor/main_loop_handler4.rb +299 -0
- data/lib/fractor/performance_metrics_collector.rb +181 -0
- data/lib/fractor/performance_monitor.rb +215 -0
- data/lib/fractor/performance_report_generator.rb +202 -0
- data/lib/fractor/priority_work.rb +93 -0
- data/lib/fractor/priority_work_queue.rb +189 -0
- data/lib/fractor/result_aggregator.rb +33 -1
- data/lib/fractor/shutdown_handler.rb +168 -0
- data/lib/fractor/signal_handler.rb +80 -0
- data/lib/fractor/supervisor.rb +430 -144
- data/lib/fractor/supervisor_logger.rb +88 -0
- data/lib/fractor/version.rb +1 -1
- data/lib/fractor/work.rb +12 -0
- data/lib/fractor/work_distribution_manager.rb +151 -0
- data/lib/fractor/work_queue.rb +88 -0
- data/lib/fractor/work_result.rb +181 -9
- data/lib/fractor/worker.rb +75 -1
- data/lib/fractor/workflow/builder.rb +210 -0
- data/lib/fractor/workflow/chain_builder.rb +169 -0
- data/lib/fractor/workflow/circuit_breaker.rb +183 -0
- data/lib/fractor/workflow/circuit_breaker_orchestrator.rb +208 -0
- data/lib/fractor/workflow/circuit_breaker_registry.rb +112 -0
- data/lib/fractor/workflow/dead_letter_queue.rb +334 -0
- data/lib/fractor/workflow/execution_hooks.rb +39 -0
- data/lib/fractor/workflow/execution_strategy.rb +225 -0
- data/lib/fractor/workflow/execution_trace.rb +134 -0
- data/lib/fractor/workflow/helpers.rb +191 -0
- data/lib/fractor/workflow/job.rb +290 -0
- data/lib/fractor/workflow/job_dependency_validator.rb +120 -0
- data/lib/fractor/workflow/logger.rb +110 -0
- data/lib/fractor/workflow/pre_execution_context.rb +193 -0
- data/lib/fractor/workflow/retry_config.rb +156 -0
- data/lib/fractor/workflow/retry_orchestrator.rb +184 -0
- data/lib/fractor/workflow/retry_strategy.rb +93 -0
- data/lib/fractor/workflow/structured_logger.rb +30 -0
- data/lib/fractor/workflow/type_compatibility_validator.rb +222 -0
- data/lib/fractor/workflow/visualizer.rb +211 -0
- data/lib/fractor/workflow/workflow_context.rb +132 -0
- data/lib/fractor/workflow/workflow_executor.rb +669 -0
- data/lib/fractor/workflow/workflow_result.rb +55 -0
- data/lib/fractor/workflow/workflow_validator.rb +295 -0
- data/lib/fractor/workflow.rb +333 -0
- data/lib/fractor/wrapped_ractor.rb +66 -91
- data/lib/fractor/wrapped_ractor3.rb +161 -0
- data/lib/fractor/wrapped_ractor4.rb +242 -0
- data/lib/fractor.rb +93 -3
- metadata +192 -6
- data/tests/sample.rb.bak +0 -309
- data/tests/sample_working.rb.bak +0 -209
|
@@ -8,7 +8,7 @@ module ProducerSubscriber
|
|
|
8
8
|
def initialize(data, depth = 0)
|
|
9
9
|
super({
|
|
10
10
|
data: data,
|
|
11
|
-
depth: depth
|
|
11
|
+
depth: depth,
|
|
12
12
|
})
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -31,7 +31,7 @@ module ProducerSubscriber
|
|
|
31
31
|
super({
|
|
32
32
|
data: data,
|
|
33
33
|
parent_id: parent_id,
|
|
34
|
-
depth: depth
|
|
34
|
+
depth: depth,
|
|
35
35
|
})
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -63,7 +63,7 @@ module ProducerSubscriber
|
|
|
63
63
|
else
|
|
64
64
|
Fractor::WorkResult.new(
|
|
65
65
|
error: "Unknown work type: #{work.class}",
|
|
66
|
-
work: work
|
|
66
|
+
work: work,
|
|
67
67
|
)
|
|
68
68
|
end
|
|
69
69
|
end
|
|
@@ -80,13 +80,13 @@ module ProducerSubscriber
|
|
|
80
80
|
# Return the result with metadata about sub-works
|
|
81
81
|
result = {
|
|
82
82
|
processed_data: processed_data,
|
|
83
|
-
sub_works: [] # Will be populated by the supervisor
|
|
83
|
+
sub_works: [], # Will be populated by the supervisor
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
# Return a successful result
|
|
87
87
|
Fractor::WorkResult.new(
|
|
88
88
|
result: result,
|
|
89
|
-
work: work
|
|
89
|
+
work: work,
|
|
90
90
|
)
|
|
91
91
|
end
|
|
92
92
|
|
|
@@ -101,9 +101,9 @@ module ProducerSubscriber
|
|
|
101
101
|
Fractor::WorkResult.new(
|
|
102
102
|
result: {
|
|
103
103
|
processed_data: processed_data,
|
|
104
|
-
parent_id: work.parent_id
|
|
104
|
+
parent_id: work.parent_id,
|
|
105
105
|
},
|
|
106
|
-
work: work
|
|
106
|
+
work: work,
|
|
107
107
|
)
|
|
108
108
|
end
|
|
109
109
|
end
|
|
@@ -122,8 +122,8 @@ module ProducerSubscriber
|
|
|
122
122
|
# Create the supervisor
|
|
123
123
|
supervisor = Fractor::Supervisor.new(
|
|
124
124
|
worker_pools: [
|
|
125
|
-
{ worker_class: MultiWorker, num_workers: @worker_count }
|
|
126
|
-
]
|
|
125
|
+
{ worker_class: MultiWorker, num_workers: @worker_count },
|
|
126
|
+
],
|
|
127
127
|
)
|
|
128
128
|
|
|
129
129
|
# Create and add initial work items
|
|
@@ -144,12 +144,14 @@ module ProducerSubscriber
|
|
|
144
144
|
# Create a new supervisor for sub-works
|
|
145
145
|
sub_supervisor = Fractor::Supervisor.new(
|
|
146
146
|
worker_pools: [
|
|
147
|
-
{ worker_class: MultiWorker, num_workers: @worker_count }
|
|
148
|
-
]
|
|
147
|
+
{ worker_class: MultiWorker, num_workers: @worker_count },
|
|
148
|
+
],
|
|
149
149
|
)
|
|
150
150
|
|
|
151
151
|
# Create and add the sub-work items
|
|
152
|
-
sub_work_items = sub_works.map
|
|
152
|
+
sub_work_items = sub_works.map do |sw|
|
|
153
|
+
SubWork.new(sw[:data], sw[:parent_id], sw[:depth])
|
|
154
|
+
end
|
|
153
155
|
sub_supervisor.add_work_items(sub_work_items)
|
|
154
156
|
sub_supervisor.run
|
|
155
157
|
|
|
@@ -179,12 +181,14 @@ module ProducerSubscriber
|
|
|
179
181
|
sub_works << {
|
|
180
182
|
data: sub_data,
|
|
181
183
|
parent_id: work.object_id,
|
|
182
|
-
depth: work.depth + 1
|
|
184
|
+
depth: work.depth + 1,
|
|
183
185
|
}
|
|
184
186
|
end
|
|
185
187
|
|
|
186
188
|
# Store the sub-work IDs in the result for reference
|
|
187
|
-
result.result[:sub_works] = sub_works.last(3).map
|
|
189
|
+
result.result[:sub_works] = sub_works.last(3).map do |sw|
|
|
190
|
+
sw[:parent_id]
|
|
191
|
+
end
|
|
188
192
|
end
|
|
189
193
|
|
|
190
194
|
sub_works
|
|
@@ -195,7 +199,7 @@ module ProducerSubscriber
|
|
|
195
199
|
initial_results.results.each do |result|
|
|
196
200
|
@result_tree[result.work.object_id] = {
|
|
197
201
|
data: result.result[:processed_data],
|
|
198
|
-
children: []
|
|
202
|
+
children: [],
|
|
199
203
|
}
|
|
200
204
|
end
|
|
201
205
|
|
|
@@ -236,7 +240,7 @@ if __FILE__ == $PROGRAM_NAME
|
|
|
236
240
|
documents = [
|
|
237
241
|
"Annual Report 2025",
|
|
238
242
|
"Technical Documentation",
|
|
239
|
-
"Research Paper"
|
|
243
|
+
"Research Paper",
|
|
240
244
|
]
|
|
241
245
|
|
|
242
246
|
worker_count = 4
|