job-workflow 0.1.3
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 +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +91 -0
- data/CHANGELOG.md +23 -0
- data/LICENSE.txt +21 -0
- data/README.md +47 -0
- data/Rakefile +55 -0
- data/Steepfile +10 -0
- data/guides/API_REFERENCE.md +112 -0
- data/guides/BEST_PRACTICES.md +113 -0
- data/guides/CACHE_STORE_INTEGRATION.md +145 -0
- data/guides/CONDITIONAL_EXECUTION.md +66 -0
- data/guides/DEPENDENCY_WAIT.md +386 -0
- data/guides/DRY_RUN.md +390 -0
- data/guides/DSL_BASICS.md +216 -0
- data/guides/ERROR_HANDLING.md +187 -0
- data/guides/GETTING_STARTED.md +524 -0
- data/guides/INSTRUMENTATION.md +131 -0
- data/guides/LIFECYCLE_HOOKS.md +415 -0
- data/guides/NAMESPACES.md +75 -0
- data/guides/OPENTELEMETRY_INTEGRATION.md +86 -0
- data/guides/PARALLEL_PROCESSING.md +302 -0
- data/guides/PRODUCTION_DEPLOYMENT.md +110 -0
- data/guides/QUEUE_MANAGEMENT.md +141 -0
- data/guides/README.md +174 -0
- data/guides/SCHEDULED_JOBS.md +165 -0
- data/guides/STRUCTURED_LOGGING.md +268 -0
- data/guides/TASK_OUTPUTS.md +240 -0
- data/guides/TESTING_STRATEGY.md +56 -0
- data/guides/THROTTLING.md +198 -0
- data/guides/TROUBLESHOOTING.md +53 -0
- data/guides/WORKFLOW_COMPOSITION.md +675 -0
- data/guides/WORKFLOW_STATUS_QUERY.md +288 -0
- data/lib/job-workflow.rb +3 -0
- data/lib/job_workflow/argument_def.rb +16 -0
- data/lib/job_workflow/arguments.rb +40 -0
- data/lib/job_workflow/auto_scaling/adapter/aws_adapter.rb +66 -0
- data/lib/job_workflow/auto_scaling/adapter.rb +31 -0
- data/lib/job_workflow/auto_scaling/configuration.rb +85 -0
- data/lib/job_workflow/auto_scaling/executor.rb +43 -0
- data/lib/job_workflow/auto_scaling.rb +69 -0
- data/lib/job_workflow/cache_store_adapters.rb +46 -0
- data/lib/job_workflow/context.rb +352 -0
- data/lib/job_workflow/dry_run_config.rb +31 -0
- data/lib/job_workflow/dsl.rb +236 -0
- data/lib/job_workflow/error_hook.rb +24 -0
- data/lib/job_workflow/hook.rb +24 -0
- data/lib/job_workflow/hook_registry.rb +66 -0
- data/lib/job_workflow/instrumentation/log_subscriber.rb +194 -0
- data/lib/job_workflow/instrumentation/opentelemetry_subscriber.rb +221 -0
- data/lib/job_workflow/instrumentation.rb +257 -0
- data/lib/job_workflow/job_status.rb +92 -0
- data/lib/job_workflow/logger.rb +86 -0
- data/lib/job_workflow/namespace.rb +36 -0
- data/lib/job_workflow/output.rb +81 -0
- data/lib/job_workflow/output_def.rb +14 -0
- data/lib/job_workflow/queue.rb +74 -0
- data/lib/job_workflow/queue_adapter.rb +38 -0
- data/lib/job_workflow/queue_adapters/abstract.rb +87 -0
- data/lib/job_workflow/queue_adapters/null_adapter.rb +127 -0
- data/lib/job_workflow/queue_adapters/solid_queue_adapter.rb +224 -0
- data/lib/job_workflow/runner.rb +173 -0
- data/lib/job_workflow/schedule.rb +46 -0
- data/lib/job_workflow/semaphore.rb +71 -0
- data/lib/job_workflow/task.rb +83 -0
- data/lib/job_workflow/task_callable.rb +43 -0
- data/lib/job_workflow/task_context.rb +70 -0
- data/lib/job_workflow/task_dependency_wait.rb +66 -0
- data/lib/job_workflow/task_enqueue.rb +50 -0
- data/lib/job_workflow/task_graph.rb +43 -0
- data/lib/job_workflow/task_job_status.rb +70 -0
- data/lib/job_workflow/task_output.rb +51 -0
- data/lib/job_workflow/task_retry.rb +64 -0
- data/lib/job_workflow/task_throttle.rb +46 -0
- data/lib/job_workflow/version.rb +5 -0
- data/lib/job_workflow/workflow.rb +87 -0
- data/lib/job_workflow/workflow_status.rb +112 -0
- data/lib/job_workflow.rb +59 -0
- data/rbs_collection.lock.yaml +172 -0
- data/rbs_collection.yaml +14 -0
- data/sig/generated/job-workflow.rbs +2 -0
- data/sig/generated/job_workflow/argument_def.rbs +14 -0
- data/sig/generated/job_workflow/arguments.rbs +26 -0
- data/sig/generated/job_workflow/auto_scaling/adapter/aws_adapter.rbs +32 -0
- data/sig/generated/job_workflow/auto_scaling/adapter.rbs +22 -0
- data/sig/generated/job_workflow/auto_scaling/configuration.rbs +50 -0
- data/sig/generated/job_workflow/auto_scaling/executor.rbs +29 -0
- data/sig/generated/job_workflow/auto_scaling.rbs +47 -0
- data/sig/generated/job_workflow/cache_store_adapters.rbs +28 -0
- data/sig/generated/job_workflow/context.rbs +155 -0
- data/sig/generated/job_workflow/dry_run_config.rbs +16 -0
- data/sig/generated/job_workflow/dsl.rbs +117 -0
- data/sig/generated/job_workflow/error_hook.rbs +18 -0
- data/sig/generated/job_workflow/hook.rbs +18 -0
- data/sig/generated/job_workflow/hook_registry.rbs +47 -0
- data/sig/generated/job_workflow/instrumentation/log_subscriber.rbs +102 -0
- data/sig/generated/job_workflow/instrumentation/opentelemetry_subscriber.rbs +113 -0
- data/sig/generated/job_workflow/instrumentation.rbs +138 -0
- data/sig/generated/job_workflow/job_status.rbs +46 -0
- data/sig/generated/job_workflow/logger.rbs +56 -0
- data/sig/generated/job_workflow/namespace.rbs +24 -0
- data/sig/generated/job_workflow/output.rbs +39 -0
- data/sig/generated/job_workflow/output_def.rbs +12 -0
- data/sig/generated/job_workflow/queue.rbs +49 -0
- data/sig/generated/job_workflow/queue_adapter.rbs +18 -0
- data/sig/generated/job_workflow/queue_adapters/abstract.rbs +56 -0
- data/sig/generated/job_workflow/queue_adapters/null_adapter.rbs +73 -0
- data/sig/generated/job_workflow/queue_adapters/solid_queue_adapter.rbs +111 -0
- data/sig/generated/job_workflow/runner.rbs +66 -0
- data/sig/generated/job_workflow/schedule.rbs +34 -0
- data/sig/generated/job_workflow/semaphore.rbs +37 -0
- data/sig/generated/job_workflow/task.rbs +60 -0
- data/sig/generated/job_workflow/task_callable.rbs +30 -0
- data/sig/generated/job_workflow/task_context.rbs +52 -0
- data/sig/generated/job_workflow/task_dependency_wait.rbs +42 -0
- data/sig/generated/job_workflow/task_enqueue.rbs +27 -0
- data/sig/generated/job_workflow/task_graph.rbs +27 -0
- data/sig/generated/job_workflow/task_job_status.rbs +42 -0
- data/sig/generated/job_workflow/task_output.rbs +29 -0
- data/sig/generated/job_workflow/task_retry.rbs +30 -0
- data/sig/generated/job_workflow/task_throttle.rbs +20 -0
- data/sig/generated/job_workflow/version.rbs +5 -0
- data/sig/generated/job_workflow/workflow.rbs +48 -0
- data/sig/generated/job_workflow/workflow_status.rbs +55 -0
- data/sig/generated/job_workflow.rbs +8 -0
- data/sig-private/activejob.rbs +35 -0
- data/sig-private/activesupport.rbs +23 -0
- data/sig-private/aws.rbs +32 -0
- data/sig-private/opentelemetry.rbs +40 -0
- data/sig-private/solid_queue.rbs +108 -0
- data/tmp/.keep +0 -0
- metadata +190 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module JobWorkflow
|
|
4
|
+
class Workflow
|
|
5
|
+
attr_reader :namespace #: Namespace
|
|
6
|
+
attr_reader :dry_run_config #: DryRunConfig
|
|
7
|
+
|
|
8
|
+
#: () -> void
|
|
9
|
+
def initialize
|
|
10
|
+
@task_graph = TaskGraph.new
|
|
11
|
+
@argument_defs = {} #: Hash[Symbol, ArgumentDef]
|
|
12
|
+
@hook_registry = HookRegistry.new
|
|
13
|
+
@namespace = Namespace.default #: Namespace
|
|
14
|
+
@schedules = {} #: Hash[Symbol, Schedule]
|
|
15
|
+
@dry_run_config = DryRunConfig.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
#: (bool | ^(Context) -> bool) -> void
|
|
19
|
+
def dry_run_config=(value)
|
|
20
|
+
@dry_run_config = DryRunConfig.from_primitive_value(value)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
#: (Namespace) { () -> void } -> void
|
|
24
|
+
def add_namespace(namespace)
|
|
25
|
+
original_namespace = @namespace
|
|
26
|
+
@namespace = namespace.update_parent(original_namespace)
|
|
27
|
+
yield
|
|
28
|
+
ensure
|
|
29
|
+
@namespace = original_namespace
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
#: (Task) -> void
|
|
33
|
+
def add_task(task)
|
|
34
|
+
@task_graph.add(task)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
#: (ArgumentDef) -> void
|
|
38
|
+
def add_argument(argument_def)
|
|
39
|
+
@argument_defs[argument_def.name] = argument_def
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
#: (Schedule) -> void
|
|
43
|
+
def add_schedule(schedule)
|
|
44
|
+
@schedules[schedule.key] = schedule
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
#: (Symbol, task_names: Array[Symbol], block: untyped) -> void
|
|
48
|
+
def add_hook(type, task_names:, block:)
|
|
49
|
+
return @hook_registry.add_before_hook(task_names:, block:) if type == :before
|
|
50
|
+
return @hook_registry.add_after_hook(task_names:, block:) if type == :after
|
|
51
|
+
return @hook_registry.add_around_hook(task_names:, block:) if type == :around
|
|
52
|
+
return @hook_registry.add_error_hook(task_names:, block:) if type == :error
|
|
53
|
+
|
|
54
|
+
raise ArgumentError, "Invalid hook type: #{type.inspect}"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
#: () -> HookRegistry
|
|
58
|
+
def hooks
|
|
59
|
+
@hook_registry
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
#: () -> Array[Task]
|
|
63
|
+
def tasks
|
|
64
|
+
@task_graph.to_a
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
#: (Symbol?) -> Task?
|
|
68
|
+
def fetch_task(task_name)
|
|
69
|
+
@task_graph.fetch(task_name)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
#: () -> Array[ArgumentDef]
|
|
73
|
+
def arguments
|
|
74
|
+
@argument_defs.values
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
#: () -> Hash[Symbol, Hash[Symbol, untyped]]
|
|
78
|
+
def build_schedules_hash
|
|
79
|
+
@schedules.transform_values(&:to_config)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
#: () -> Hash[Symbol, untyped]
|
|
83
|
+
def build_arguments_hash
|
|
84
|
+
arguments.to_h { |def_obj| [def_obj.name, def_obj.default] }
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module JobWorkflow
|
|
4
|
+
class WorkflowStatus
|
|
5
|
+
class NotFoundError < StandardError; end
|
|
6
|
+
|
|
7
|
+
# @rbs!
|
|
8
|
+
# type status_type = :pending | :running | :completed | :failed
|
|
9
|
+
|
|
10
|
+
attr_reader :context #: Context
|
|
11
|
+
attr_reader :job_class_name #: String
|
|
12
|
+
attr_reader :status #: status_type
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
#: (String) -> WorkflowStatus
|
|
16
|
+
def find(job_id)
|
|
17
|
+
workflow_status = find_by(job_id:)
|
|
18
|
+
raise NotFoundError, "Workflow with job_id '#{job_id}' not found" if workflow_status.nil?
|
|
19
|
+
|
|
20
|
+
workflow_status
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
#: (job_id: String) -> WorkflowStatus?
|
|
24
|
+
def find_by(job_id:)
|
|
25
|
+
data = QueueAdapter.current.find_job(job_id)
|
|
26
|
+
return if data.nil?
|
|
27
|
+
|
|
28
|
+
WorkflowStatus.from_job_data(data)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
#: (Hash[String, untyped]) -> WorkflowStatus
|
|
32
|
+
def from_job_data(data)
|
|
33
|
+
job_class_name = data["class_name"]
|
|
34
|
+
job_class = job_class_name.constantize
|
|
35
|
+
workflow = job_class._workflow
|
|
36
|
+
|
|
37
|
+
context_data = data["arguments"].first["job_workflow_context"]
|
|
38
|
+
context = if context_data
|
|
39
|
+
Context.deserialize(context_data.merge("workflow" => workflow))
|
|
40
|
+
else
|
|
41
|
+
Context.from_hash({ workflow: })
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
new(context:, job_class_name:, status: data["status"])
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
#: (context: Context, job_class_name: String, status: status_type) -> void
|
|
49
|
+
def initialize(context:, job_class_name:, status:)
|
|
50
|
+
@context = context #: Context
|
|
51
|
+
@job_class_name = job_class_name #: String
|
|
52
|
+
@status = status #: Symbol
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
#: () -> Symbol?
|
|
56
|
+
def current_task_name
|
|
57
|
+
context._task_context.task&.task_name
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
#: () -> Arguments
|
|
61
|
+
def arguments
|
|
62
|
+
context.arguments
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
#: () -> Output
|
|
66
|
+
def output
|
|
67
|
+
context.output
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
#: () -> JobStatus
|
|
71
|
+
def job_status
|
|
72
|
+
context.job_status
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
#: () -> bool
|
|
76
|
+
def running?
|
|
77
|
+
status == :running
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
#: () -> bool
|
|
81
|
+
def completed?
|
|
82
|
+
status == :succeeded
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
#: () -> bool
|
|
86
|
+
def failed?
|
|
87
|
+
status == :failed
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
#: () -> bool
|
|
91
|
+
def pending?
|
|
92
|
+
status == :pending
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
#: () -> Hash[Symbol, untyped]
|
|
96
|
+
def to_h
|
|
97
|
+
{
|
|
98
|
+
status:,
|
|
99
|
+
job_class_name:,
|
|
100
|
+
current_task_name:,
|
|
101
|
+
arguments: arguments.to_h,
|
|
102
|
+
output: output.flat_task_outputs.map do |task_output|
|
|
103
|
+
{
|
|
104
|
+
task_name: task_output.task_name,
|
|
105
|
+
each_index: task_output.each_index,
|
|
106
|
+
data: task_output.data
|
|
107
|
+
}
|
|
108
|
+
end
|
|
109
|
+
}
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
data/lib/job_workflow.rb
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "json"
|
|
4
|
+
require "timeout"
|
|
5
|
+
require "tsort"
|
|
6
|
+
require "uri"
|
|
7
|
+
require "net/http"
|
|
8
|
+
require "active_support"
|
|
9
|
+
require "active_support/concern"
|
|
10
|
+
require "active_support/core_ext"
|
|
11
|
+
require "active_support/log_subscriber"
|
|
12
|
+
require "active_job"
|
|
13
|
+
require_relative "job_workflow/version"
|
|
14
|
+
require_relative "job_workflow/logger"
|
|
15
|
+
require_relative "job_workflow/instrumentation"
|
|
16
|
+
require_relative "job_workflow/instrumentation/log_subscriber"
|
|
17
|
+
require_relative "job_workflow/instrumentation/opentelemetry_subscriber"
|
|
18
|
+
require_relative "job_workflow/queue_adapter"
|
|
19
|
+
require_relative "job_workflow/cache_store_adapters"
|
|
20
|
+
require_relative "job_workflow/dry_run_config"
|
|
21
|
+
require_relative "job_workflow/task_retry"
|
|
22
|
+
require_relative "job_workflow/task_throttle"
|
|
23
|
+
require_relative "job_workflow/task_enqueue"
|
|
24
|
+
require_relative "job_workflow/task_dependency_wait"
|
|
25
|
+
require_relative "job_workflow/semaphore"
|
|
26
|
+
require_relative "job_workflow/namespace"
|
|
27
|
+
require_relative "job_workflow/hook"
|
|
28
|
+
require_relative "job_workflow/error_hook"
|
|
29
|
+
require_relative "job_workflow/hook_registry"
|
|
30
|
+
require_relative "job_workflow/task_callable"
|
|
31
|
+
require_relative "job_workflow/task"
|
|
32
|
+
require_relative "job_workflow/task_graph"
|
|
33
|
+
require_relative "job_workflow/schedule"
|
|
34
|
+
require_relative "job_workflow/dsl"
|
|
35
|
+
require_relative "job_workflow/runner"
|
|
36
|
+
require_relative "job_workflow/workflow_status"
|
|
37
|
+
require_relative "job_workflow/workflow"
|
|
38
|
+
require_relative "job_workflow/argument_def"
|
|
39
|
+
require_relative "job_workflow/arguments"
|
|
40
|
+
require_relative "job_workflow/task_context"
|
|
41
|
+
require_relative "job_workflow/task_job_status"
|
|
42
|
+
require_relative "job_workflow/job_status"
|
|
43
|
+
require_relative "job_workflow/context"
|
|
44
|
+
require_relative "job_workflow/output_def"
|
|
45
|
+
require_relative "job_workflow/task_output"
|
|
46
|
+
require_relative "job_workflow/output"
|
|
47
|
+
require_relative "job_workflow/queue"
|
|
48
|
+
require_relative "job_workflow/auto_scaling"
|
|
49
|
+
|
|
50
|
+
module JobWorkflow
|
|
51
|
+
class Error < StandardError; end
|
|
52
|
+
|
|
53
|
+
extend Logger
|
|
54
|
+
|
|
55
|
+
Instrumentation::LogSubscriber.attach!
|
|
56
|
+
|
|
57
|
+
ActiveSupport.on_load(:solid_queue) { QueueAdapter.current.initialize_adapter! }
|
|
58
|
+
QueueAdapter.current.initialize_adapter!
|
|
59
|
+
end
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
path: ".gem_rbs_collection"
|
|
3
|
+
gems:
|
|
4
|
+
- name: activejob
|
|
5
|
+
version: '6.0'
|
|
6
|
+
source:
|
|
7
|
+
type: git
|
|
8
|
+
name: ruby/gem_rbs_collection
|
|
9
|
+
revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789
|
|
10
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
11
|
+
repo_dir: gems
|
|
12
|
+
- name: activerecord
|
|
13
|
+
version: '8.0'
|
|
14
|
+
source:
|
|
15
|
+
type: git
|
|
16
|
+
name: ruby/gem_rbs_collection
|
|
17
|
+
revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789
|
|
18
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
19
|
+
repo_dir: gems
|
|
20
|
+
- name: activesupport
|
|
21
|
+
version: '7.0'
|
|
22
|
+
source:
|
|
23
|
+
type: git
|
|
24
|
+
name: ruby/gem_rbs_collection
|
|
25
|
+
revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789
|
|
26
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
27
|
+
repo_dir: gems
|
|
28
|
+
- name: base64
|
|
29
|
+
version: 0.3.0
|
|
30
|
+
source:
|
|
31
|
+
type: rubygems
|
|
32
|
+
- name: bigdecimal
|
|
33
|
+
version: '4.0'
|
|
34
|
+
source:
|
|
35
|
+
type: git
|
|
36
|
+
name: ruby/gem_rbs_collection
|
|
37
|
+
revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789
|
|
38
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
39
|
+
repo_dir: gems
|
|
40
|
+
- name: concurrent-ruby
|
|
41
|
+
version: '1.1'
|
|
42
|
+
source:
|
|
43
|
+
type: git
|
|
44
|
+
name: ruby/gem_rbs_collection
|
|
45
|
+
revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789
|
|
46
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
47
|
+
repo_dir: gems
|
|
48
|
+
- name: connection_pool
|
|
49
|
+
version: '2.4'
|
|
50
|
+
source:
|
|
51
|
+
type: git
|
|
52
|
+
name: ruby/gem_rbs_collection
|
|
53
|
+
revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789
|
|
54
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
55
|
+
repo_dir: gems
|
|
56
|
+
- name: date
|
|
57
|
+
version: '0'
|
|
58
|
+
source:
|
|
59
|
+
type: stdlib
|
|
60
|
+
- name: delegate
|
|
61
|
+
version: '0'
|
|
62
|
+
source:
|
|
63
|
+
type: stdlib
|
|
64
|
+
- name: digest
|
|
65
|
+
version: '0'
|
|
66
|
+
source:
|
|
67
|
+
type: stdlib
|
|
68
|
+
- name: erb
|
|
69
|
+
version: '0'
|
|
70
|
+
source:
|
|
71
|
+
type: stdlib
|
|
72
|
+
- name: globalid
|
|
73
|
+
version: '1.1'
|
|
74
|
+
source:
|
|
75
|
+
type: git
|
|
76
|
+
name: ruby/gem_rbs_collection
|
|
77
|
+
revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789
|
|
78
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
79
|
+
repo_dir: gems
|
|
80
|
+
- name: i18n
|
|
81
|
+
version: '1.10'
|
|
82
|
+
source:
|
|
83
|
+
type: git
|
|
84
|
+
name: ruby/gem_rbs_collection
|
|
85
|
+
revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789
|
|
86
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
87
|
+
repo_dir: gems
|
|
88
|
+
- name: json
|
|
89
|
+
version: '0'
|
|
90
|
+
source:
|
|
91
|
+
type: stdlib
|
|
92
|
+
- name: logger
|
|
93
|
+
version: '0'
|
|
94
|
+
source:
|
|
95
|
+
type: stdlib
|
|
96
|
+
- name: minitest
|
|
97
|
+
version: '5.25'
|
|
98
|
+
source:
|
|
99
|
+
type: git
|
|
100
|
+
name: ruby/gem_rbs_collection
|
|
101
|
+
revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789
|
|
102
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
103
|
+
repo_dir: gems
|
|
104
|
+
- name: monitor
|
|
105
|
+
version: '0'
|
|
106
|
+
source:
|
|
107
|
+
type: stdlib
|
|
108
|
+
- name: net-http
|
|
109
|
+
version: '0'
|
|
110
|
+
source:
|
|
111
|
+
type: stdlib
|
|
112
|
+
- name: net-protocol
|
|
113
|
+
version: '0'
|
|
114
|
+
source:
|
|
115
|
+
type: stdlib
|
|
116
|
+
- name: openssl
|
|
117
|
+
version: '0'
|
|
118
|
+
source:
|
|
119
|
+
type: stdlib
|
|
120
|
+
- name: prism
|
|
121
|
+
version: 1.7.0
|
|
122
|
+
source:
|
|
123
|
+
type: rubygems
|
|
124
|
+
- name: securerandom
|
|
125
|
+
version: '0'
|
|
126
|
+
source:
|
|
127
|
+
type: stdlib
|
|
128
|
+
- name: singleton
|
|
129
|
+
version: '0'
|
|
130
|
+
source:
|
|
131
|
+
type: stdlib
|
|
132
|
+
- name: socket
|
|
133
|
+
version: '0'
|
|
134
|
+
source:
|
|
135
|
+
type: stdlib
|
|
136
|
+
- name: sqlite3
|
|
137
|
+
version: '2.0'
|
|
138
|
+
source:
|
|
139
|
+
type: git
|
|
140
|
+
name: ruby/gem_rbs_collection
|
|
141
|
+
revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789
|
|
142
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
143
|
+
repo_dir: gems
|
|
144
|
+
- name: stringio
|
|
145
|
+
version: '0'
|
|
146
|
+
source:
|
|
147
|
+
type: stdlib
|
|
148
|
+
- name: time
|
|
149
|
+
version: '0'
|
|
150
|
+
source:
|
|
151
|
+
type: stdlib
|
|
152
|
+
- name: timeout
|
|
153
|
+
version: '0'
|
|
154
|
+
source:
|
|
155
|
+
type: stdlib
|
|
156
|
+
- name: tsort
|
|
157
|
+
version: '0'
|
|
158
|
+
source:
|
|
159
|
+
type: stdlib
|
|
160
|
+
- name: tzinfo
|
|
161
|
+
version: '2.0'
|
|
162
|
+
source:
|
|
163
|
+
type: git
|
|
164
|
+
name: ruby/gem_rbs_collection
|
|
165
|
+
revision: 2af46cde7fec5e4130f6c84c5b691c0538af8789
|
|
166
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
167
|
+
repo_dir: gems
|
|
168
|
+
- name: uri
|
|
169
|
+
version: '0'
|
|
170
|
+
source:
|
|
171
|
+
type: stdlib
|
|
172
|
+
gemfile_lock_path: Gemfile.lock
|
data/rbs_collection.yaml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Download sources
|
|
2
|
+
sources:
|
|
3
|
+
- type: git
|
|
4
|
+
name: ruby/gem_rbs_collection
|
|
5
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
6
|
+
revision: main
|
|
7
|
+
repo_dir: gems
|
|
8
|
+
|
|
9
|
+
path: .gem_rbs_collection
|
|
10
|
+
|
|
11
|
+
gems:
|
|
12
|
+
- name: net-http
|
|
13
|
+
- name: activerecord
|
|
14
|
+
- name: tsort
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Generated from lib/job_workflow/argument_def.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module JobWorkflow
|
|
4
|
+
class ArgumentDef
|
|
5
|
+
attr_reader name: Symbol
|
|
6
|
+
|
|
7
|
+
attr_reader type: String
|
|
8
|
+
|
|
9
|
+
attr_reader default: untyped
|
|
10
|
+
|
|
11
|
+
# : (name: Symbol, type: String, default: untyped) -> void
|
|
12
|
+
def initialize: (name: Symbol, type: String, default: untyped) -> void
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Generated from lib/job_workflow/arguments.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module JobWorkflow
|
|
4
|
+
class Arguments
|
|
5
|
+
# : (data: Hash[Symbol, untyped]) -> void
|
|
6
|
+
def initialize: (data: Hash[Symbol, untyped]) -> void
|
|
7
|
+
|
|
8
|
+
# : (Hash[Symbol, untyped] other_data) -> Arguments
|
|
9
|
+
def merge: (Hash[Symbol, untyped] other_data) -> Arguments
|
|
10
|
+
|
|
11
|
+
# : (Symbol name, *untyped args, **untyped kwargs) ?{ () -> untyped } -> untyped
|
|
12
|
+
def method_missing: (Symbol name, *untyped args, **untyped kwargs) ?{ () -> untyped } -> untyped
|
|
13
|
+
|
|
14
|
+
# : (Symbol sym, bool include_private) -> bool
|
|
15
|
+
def respond_to_missing?: (Symbol sym, bool include_private) -> bool
|
|
16
|
+
|
|
17
|
+
# : () -> Hash[Symbol, untyped]
|
|
18
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
attr_reader data: Hash[Symbol, untyped]
|
|
23
|
+
|
|
24
|
+
attr_reader reader_names: Set[Symbol]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Generated from lib/job_workflow/auto_scaling/adapter/aws_adapter.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module JobWorkflow
|
|
4
|
+
module AutoScaling
|
|
5
|
+
module Adapter
|
|
6
|
+
class AwsAdapter
|
|
7
|
+
# : (?ecs_client: Aws::ECS::Client?) -> void
|
|
8
|
+
def initialize: (?ecs_client: Aws::ECS::Client?) -> void
|
|
9
|
+
|
|
10
|
+
# : (Integer) -> Integer?
|
|
11
|
+
def update_desired_count: (Integer) -> Integer?
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
attr_reader ecs_client: Aws::ECS::Client
|
|
16
|
+
|
|
17
|
+
attr_reader cluster: String
|
|
18
|
+
|
|
19
|
+
attr_reader task_arn: String
|
|
20
|
+
|
|
21
|
+
# : () -> String
|
|
22
|
+
def describe_service_name: () -> String
|
|
23
|
+
|
|
24
|
+
# : () -> Aws::ECS::Types::Service
|
|
25
|
+
def describe_service: () -> Aws::ECS::Types::Service
|
|
26
|
+
|
|
27
|
+
# : (service: Aws::ECS::Types::Service, desired_count: Integer) -> Aws::ECS::Types::UpdateServiceResponse
|
|
28
|
+
def update_service: (service: Aws::ECS::Types::Service, desired_count: Integer) -> Aws::ECS::Types::UpdateServiceResponse
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Generated from lib/job_workflow/auto_scaling/adapter.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module JobWorkflow
|
|
4
|
+
module AutoScaling
|
|
5
|
+
module Adapter
|
|
6
|
+
interface _ClassMethods
|
|
7
|
+
def new: () -> _InstanceMethods
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
interface _InstanceMethods
|
|
11
|
+
def class: () -> _ClassMethods
|
|
12
|
+
|
|
13
|
+
def update_desired_count: (Integer) -> Integer?
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
ADAPTERS: Hash[Symbol, _ClassMethods]
|
|
17
|
+
|
|
18
|
+
# : (Symbol) -> _ClassMethods
|
|
19
|
+
def self.fetch: (Symbol) -> _ClassMethods
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Generated from lib/job_workflow/auto_scaling/configuration.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module JobWorkflow
|
|
4
|
+
module AutoScaling
|
|
5
|
+
class Configuration
|
|
6
|
+
attr_reader queue_name: String
|
|
7
|
+
|
|
8
|
+
attr_reader min_count: Integer
|
|
9
|
+
|
|
10
|
+
attr_reader max_count: Integer
|
|
11
|
+
|
|
12
|
+
attr_reader step_count: Integer
|
|
13
|
+
|
|
14
|
+
attr_reader max_latency: Integer
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
# : (
|
|
18
|
+
# ?queue_name: String,
|
|
19
|
+
# ?min_count: Integer,
|
|
20
|
+
# ?max_count: Integer,
|
|
21
|
+
# ?step_count: Integer,
|
|
22
|
+
# ?max_latency: Integer
|
|
23
|
+
# ) -> void
|
|
24
|
+
def initialize: (?queue_name: String, ?min_count: Integer, ?max_count: Integer, ?step_count: Integer, ?max_latency: Integer) -> void
|
|
25
|
+
|
|
26
|
+
# : () -> Integer
|
|
27
|
+
def latency_per_step_count: () -> Integer
|
|
28
|
+
|
|
29
|
+
# : (String) -> void
|
|
30
|
+
def queue_name=: (String) -> void
|
|
31
|
+
|
|
32
|
+
# : (Integer) -> void
|
|
33
|
+
def min_count=: (Integer) -> void
|
|
34
|
+
|
|
35
|
+
# : (Integer) -> void
|
|
36
|
+
def max_count=: (Integer) -> void
|
|
37
|
+
|
|
38
|
+
# : (Integer) -> void
|
|
39
|
+
def step_count=: (Integer) -> void
|
|
40
|
+
|
|
41
|
+
# : (Integer) -> void
|
|
42
|
+
def max_latency=: (Integer) -> void
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
# : (Integer) -> void
|
|
47
|
+
def assert_positive_number!: (Integer) -> void
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Generated from lib/job_workflow/auto_scaling/executor.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module JobWorkflow
|
|
4
|
+
module AutoScaling
|
|
5
|
+
class Executor
|
|
6
|
+
# : (Configuration) -> void
|
|
7
|
+
def initialize: (Configuration) -> void
|
|
8
|
+
|
|
9
|
+
# : () -> Integer?
|
|
10
|
+
def update_desired_count: () -> Integer?
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
attr_reader config: Configuration
|
|
15
|
+
|
|
16
|
+
# : () -> Adapter::_InstanceMethods
|
|
17
|
+
def adapter: () -> Adapter::_InstanceMethods
|
|
18
|
+
|
|
19
|
+
# : () -> Integer?
|
|
20
|
+
def queue_latency: () -> Integer?
|
|
21
|
+
|
|
22
|
+
# : () -> Integer
|
|
23
|
+
def desired_count_by_latency: () -> Integer
|
|
24
|
+
|
|
25
|
+
# : () -> Array[Integer]
|
|
26
|
+
def desired_count_list: () -> Array[Integer]
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Generated from lib/job_workflow/auto_scaling.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module JobWorkflow
|
|
4
|
+
# @example
|
|
5
|
+
# ```ruby
|
|
6
|
+
# class AutoScalingJob < ApplicationJob
|
|
7
|
+
# include JobWorkflow::AutoScaling
|
|
8
|
+
#
|
|
9
|
+
# target_queue_name "my_queue"
|
|
10
|
+
# min_count 2
|
|
11
|
+
# max_count 10
|
|
12
|
+
# step_count 2
|
|
13
|
+
# max_latency 1800
|
|
14
|
+
# end
|
|
15
|
+
# ```
|
|
16
|
+
module AutoScaling
|
|
17
|
+
extend ActiveSupport::Concern
|
|
18
|
+
|
|
19
|
+
extend ClassMethods
|
|
20
|
+
|
|
21
|
+
def class: () -> ClassMethods
|
|
22
|
+
|
|
23
|
+
# : () -> void
|
|
24
|
+
def perform: () -> void
|
|
25
|
+
|
|
26
|
+
module ClassMethods
|
|
27
|
+
def class_attribute: (Symbol, default: untyped, ?instance_writer: bool) -> void
|
|
28
|
+
|
|
29
|
+
def _config: () -> Configuration
|
|
30
|
+
|
|
31
|
+
# : (String) -> void
|
|
32
|
+
def target_queue_name: (String) -> void
|
|
33
|
+
|
|
34
|
+
# : (Integer) -> void
|
|
35
|
+
def min_count: (Integer) -> void
|
|
36
|
+
|
|
37
|
+
# : (Integer) -> void
|
|
38
|
+
def max_count: (Integer) -> void
|
|
39
|
+
|
|
40
|
+
# : (Integer) -> void
|
|
41
|
+
def step_count: (Integer) -> void
|
|
42
|
+
|
|
43
|
+
# : (Integer) -> void
|
|
44
|
+
def max_latency: (Integer) -> void
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|