# | Batch operation instances (defaults only) # | Migrated from: provisioning/kcl/batch.k # | Pattern: Hybrid - defaults + makers + direct access (contracts available via import) let contracts_lib = import "./contracts.ncl" in let defaults_lib = import "./defaults.ncl" in { # ============================================================================ # SECTION 1: Direct access to defaults (for reference) # Use when: Understanding default values, building custom instances manually # Exported: YES - for inspection and custom building # ============================================================================ defaults = defaults_lib, # ============================================================================ # SECTION 2: Convenience makers (90% of use cases) # Use when: Creating instances with overrides, simple customization # Note: Not exported to TOML/JSON (functions aren't serializable) # Import batch.ncl in Nickel code and use these functions # ============================================================================ # Make a scheduler with optional overrides make_scheduler | not_exported = fun overrides => defaults_lib.scheduler & overrides, # Make a queue with optional overrides make_queue | not_exported = fun overrides => defaults_lib.queue & overrides, # Make a resource constraint with optional overrides make_resource_constraint | not_exported = fun overrides => defaults_lib.resource_constraint & overrides, # Make a metrics config with optional overrides make_metrics | not_exported = fun overrides => defaults_lib.metrics & overrides, # Make a provider mix config with optional overrides make_provider_mix | not_exported = fun overrides => defaults_lib.provider_mix & overrides, # Make a health check with optional overrides make_health_check | not_exported = fun overrides => defaults_lib.health_check & overrides, # Make an autoscaling config with optional overrides make_autoscaling | not_exported = fun overrides => defaults_lib.autoscaling & overrides, # Make an executor with optional overrides make_executor | not_exported = fun overrides => defaults_lib.executor & overrides, # ============================================================================ # SECTION 3: Default instances (bare defaults) # Use when: Need unmodified default values # Exported: YES - for direct use without customization # ============================================================================ DefaultScheduler = defaults_lib.scheduler, DefaultQueue = defaults_lib.queue, DefaultResourceConstraint = defaults_lib.resource_constraint, DefaultMetrics = defaults_lib.metrics, DefaultProviderMixConfig = defaults_lib.provider_mix, DefaultHealthCheck = defaults_lib.health_check, DefaultAutoscaling = defaults_lib.autoscaling, DefaultExecutor = defaults_lib.executor, # Constant arrays BatchOperationTypes = defaults_lib.operation_types, BatchProviders = defaults_lib.providers, # ============================================================================ # SECTION 4: Concrete production instance # Ready-to-use production-grade configuration # Exported: YES - production-ready configuration # ============================================================================ DefaultBatchConfig = { executor_id = "default_batch_executor", name = "Default Batch Executor", description = "Default configuration-driven batch executor for provisioning operations", scheduler = { strategy = "dependency_first", resource_limits = { "max_cpu_cores" = 8, "max_memory_mb" = 16384, "max_network_bandwidth" = 1000, }, scheduling_interval = 10, enable_preemption = false, }, provider_config = { primary_provider = "upcloud", secondary_providers = ["aws", "local"], provider_selection = "primary_first", cross_provider_networking = {}, provider_limits = {}, }, queues = [], resource_constraints = [], autoscaling = { enabled = true, min_parallel = 2, max_parallel = 8, scale_up_threshold = 0.8, scale_down_threshold = 0.2, cooldown_period = 300, scale_step = 1, target_utilization = 0.7, }, security_config = {}, audit_logging = true, audit_log_path = "./logs/batch_audit.log", webhook_endpoints = [], api_endpoints = [], performance_config = { "io_threads" = "4", "worker_threads" = "8", "batch_size" = "100", }, }, }