# Policy: Queue-based Full Stack Simulation
#
# This policy simulates a complete workflow by running both authentication
# and download workers simultaneously, processing tasks from Redis queues.
#
name: queue_full_stack_simulation

settings:
  mode: full_stack
  orchestration_mode: queue_full_stack
  profile_mode: from_pool_with_lock
  # Directory to save info.json files (optional)
  save_info_json_dir: "run/queue_auth_results"

  dummy_simulation_settings:
    auth_min_seconds: 0.75
    auth_max_seconds: 1.5
    auth_failure_rate: 0.0
    auth_skipped_failure_rate: 0.0
    download_min_seconds: 5
    download_max_seconds: 8
    download_failure_rate: 0.0
    download_skipped_failure_rate: 0.0

execution_control:
  # Number of workers for each stage
  auth_workers: 2
  download_workers: 4
  # How long a worker should pause if it cannot find an available profile or task.
  worker_polling_interval_seconds: 1
  # Run until conditions
  run_until:
    # Run for this many minutes (0 = unlimited)
    minutes: 0
    # Process this many requests (0 = unlimited)
    requests: 0

info_json_generation_policy:
  profile_prefix: "user1"
  client: "ytdlp"
  # Extra arguments to pass to the get-info command
  extra_args: "--verbose"

download_policy:
  profile_prefix: "user1"
  # Default cooldown in seconds if not specified by the enforcer in Redis.
  default_unlock_cooldown_seconds: 1
  # Directory to save downloaded files
  output_dir: "downloaded_media/queue_downloads"
  # Extra arguments to pass to the download command
  extra_args: "--verbose"

  # After a download task is successfully processed, rename the source info.json
  # to prevent re-processing. This is safe if you generate one download task per info.json.
  rename_source_info_json_on_success: true

queue_policy:
  # Redis connection settings (can be overridden by CLI args)
  redis_host: "localhost"
  redis_port: 6379
  redis_password: ""
  redis_db: 0
  
  # If specified, create download tasks for these formats
  # Can be "all", a specific format ID, or a list of format IDs
  formats_to_download: "140-dashy/140-dashy-0/140,299-dashy/298-dashy/137-dashy/136-dashy/135-dashy/134-dashy/133-dashy"
  
  # How many tasks to process in a batch (for batch operations)
  batch_size: 10
  
  # Queue management options
  requeue_failed_tasks: true
  requeue_batch_size: 50
  requeue_interval_seconds: 300

simulation_parameters:
  auth_env: "sim_auth"
  download_env: "sim_download"
