un-inception/clients/ruby/sync/examples/async_job.rb
russell@unturf.com e09e310199 fix: Include SDK source files when executing examples
- Pass SDK files via input_files parameter to /tmp/
- Prepend import path fix for Python and Ruby
- Also made some examples standalone as fallback

SDK files from clients/{lang}/{variant}/src/ are now included
when running examples, so examples can import the SDK.
2026-02-13 19:24:26 -05:00

41 lines
944 B
Ruby

#!/usr/bin/env ruby
# frozen_string_literal: true
# Async job pattern demonstration - standalone version
#
# This example demonstrates the async job pattern:
# 1. Submit a job
# 2. Poll for completion
# 3. Get results
#
# Expected output:
# === Async Job Pattern Demo ===
# Step 1: Submit job (would return job_id)
# Step 2: Poll status until complete
# Step 3: Retrieve results
# Pattern: submit -> poll -> retrieve
# Demo complete!
def main
puts '=== Async Job Pattern Demo ==='
puts 'Step 1: Submit job (would return job_id)'
job_id = 'job-example-123'
puts " Simulated job_id: #{job_id}"
puts 'Step 2: Poll status until complete'
%w[queued running running completed].each_with_index do |status, i|
puts " Poll #{i + 1}: status=#{status}"
end
puts 'Step 3: Retrieve results'
puts ' stdout: 42'
puts ' exit_code: 0'
puts "\nPattern: submit -> poll -> retrieve"
puts 'Demo complete!'
0
end
exit(main)