iron_worker_ng 0.7.4 → 0.8.0
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.
- data/README.md +6 -7
- data/VERSION +1 -1
- data/bin/iron_worker +15 -42
- data/lib/iron_worker_ng/api_client.rb +33 -24
- data/lib/iron_worker_ng/client.rb +49 -10
- data/lib/iron_worker_ng/code/base.rb +136 -39
- data/lib/iron_worker_ng/code/binary.rb +4 -10
- data/lib/iron_worker_ng/code/builder.rb +10 -4
- data/lib/iron_worker_ng/code/java.rb +4 -22
- data/lib/iron_worker_ng/code/mono.rb +13 -0
- data/lib/iron_worker_ng/code/node.rb +4 -8
- data/lib/iron_worker_ng/code/php.rb +13 -0
- data/lib/iron_worker_ng/code/python.rb +13 -0
- data/lib/iron_worker_ng/code/ruby.rb +4 -89
- data/lib/iron_worker_ng/code/runtime/binary.rb +19 -0
- data/lib/iron_worker_ng/code/runtime/java.rb +31 -0
- data/lib/iron_worker_ng/code/runtime/mono.rb +17 -0
- data/lib/iron_worker_ng/code/runtime/node.rb +17 -0
- data/lib/iron_worker_ng/code/runtime/php.rb +59 -0
- data/lib/iron_worker_ng/code/runtime/python.rb +17 -0
- data/lib/iron_worker_ng/code/runtime/ruby.rb +96 -0
- data/lib/iron_worker_ng/feature/base.rb +1 -2
- data/lib/iron_worker_ng/feature/binary/merge_exec.rb +3 -5
- data/lib/iron_worker_ng/feature/common/merge_dir.rb +0 -4
- data/lib/iron_worker_ng/feature/common/merge_file.rb +0 -4
- data/lib/iron_worker_ng/feature/java/merge_exec.rb +3 -5
- data/lib/iron_worker_ng/feature/java/merge_jar.rb +0 -4
- data/lib/iron_worker_ng/feature/mono/merge_exec.rb +51 -0
- data/lib/iron_worker_ng/feature/node/merge_exec.rb +3 -5
- data/lib/iron_worker_ng/feature/php/merge_exec.rb +51 -0
- data/lib/iron_worker_ng/feature/python/merge_exec.rb +51 -0
- data/lib/iron_worker_ng/feature/ruby/merge_exec.rb +3 -5
- data/lib/iron_worker_ng/feature/ruby/merge_gem.rb +4 -4
- data/lib/iron_worker_ng/feature/ruby/merge_gemfile.rb +0 -4
- data/lib/iron_worker_ng.rb +9 -1
- data/remote_test.rb +3 -1
- metadata +18 -7
- data/lib/iron_worker_ng/code/creator.rb +0 -63
- data/lib/iron_worker_ng/code/initializer.rb +0 -76
data/README.md
CHANGED
@@ -19,12 +19,6 @@ Also, you'll need a Ruby 1.9 interpreter and the IronWorkerNG gem. Install it us
|
|
19
19
|
gem install iron_worker_ng
|
20
20
|
```
|
21
21
|
|
22
|
-
We recommend that you install the `typhoeus` gem as well for faster API interaction.
|
23
|
-
|
24
|
-
```sh
|
25
|
-
gem install typhoeus
|
26
|
-
```
|
27
|
-
|
28
22
|
# Creating A Worker
|
29
23
|
|
30
24
|
Each IronWorkerNG Ruby worker is just Ruby code. It can be as simple or as complex as you want. For example,
|
@@ -83,6 +77,12 @@ client = IronWorkerNG::Client.new
|
|
83
77
|
client.tasks.create("hello", "foo"=>"bar")
|
84
78
|
end
|
85
79
|
```
|
80
|
+
### Debugging
|
81
|
+
|
82
|
+
To get a bunch of extra output to debug things, turn it on using:
|
83
|
+
|
84
|
+
IronCore::Logger.logger.level = ::Logger::DEBUG
|
85
|
+
|
86
86
|
|
87
87
|
## IronWorkerNG::Code::Ruby API
|
88
88
|
|
@@ -95,7 +95,6 @@ Create new code package with the specified args.
|
|
95
95
|
```ruby
|
96
96
|
code_with_name = IronWorkerNG::Code::Ruby.new(:exec => 'cool_worker.rb', :name => 'CoolWorker')
|
97
97
|
code_with_guessed_name = IronWorkerNG::Code::Ruby.new(:exec => 'cool_worker.rb')
|
98
|
-
code_with_short_form_syntax = IronWorkeNG::Code::Ruby.new('cool_worker.rb')
|
99
98
|
code = IronWorkerNG::Code::Ruby.new # will need to use code.merge_exec later
|
100
99
|
```
|
101
100
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
data/bin/iron_worker
CHANGED
@@ -31,44 +31,20 @@ if $*.include?('--debug')
|
|
31
31
|
$*.reject! { |p| p == '--debug' }
|
32
32
|
end
|
33
33
|
|
34
|
-
client = IronWorkerNG::Client.new
|
35
|
-
|
36
34
|
if command == 'codes.create'
|
37
35
|
if $*.size > 0 && $*[0][0] != '-'
|
38
36
|
$*.unshift('-n')
|
39
37
|
end
|
40
38
|
|
41
|
-
runtimes = IronWorkerNG::Code::Base.registered_types
|
42
|
-
runtimes_help = runtimes[0][:name] + ' (default)' + (runtimes.size == 1 ? '' : ', ') + runtimes.map { |r| r[:name] }[1 .. -1].join(', ')
|
43
|
-
|
44
|
-
features = []
|
45
|
-
|
46
39
|
name = nil
|
47
|
-
|
48
|
-
execute_features = []
|
40
|
+
wfile = nil
|
49
41
|
|
50
42
|
opts = OptionParser.new do |opts|
|
51
43
|
opts.banner = "usage: iron_worker #{command} [OPTIONS]"
|
52
44
|
|
53
|
-
opts.on('-
|
54
|
-
runtime = v
|
55
|
-
end
|
56
|
-
|
57
|
-
opts.on('-n', '--name NAME', 'code name') do |v|
|
45
|
+
opts.on('-n', '--name NAME', 'code name or workerfile') do |v|
|
58
46
|
name = v
|
59
47
|
end
|
60
|
-
|
61
|
-
IronWorkerNG::Code::Base.registered_features.each do |f|
|
62
|
-
prefix = ''
|
63
|
-
|
64
|
-
if f[:for_klass] != IronWorkerNG::Code::Base
|
65
|
-
prefix = runtimes.find { |r| r[:klass] == f[:for_klass] }[:name] + '-'
|
66
|
-
end
|
67
|
-
|
68
|
-
opts.on("--#{prefix}#{f[:name].gsub('_', '-')} #{f[:args]}", Array) do |v|
|
69
|
-
execute_features << {:name => f[:name], :args => v}
|
70
|
-
end
|
71
|
-
end
|
72
48
|
end
|
73
49
|
|
74
50
|
begin
|
@@ -78,21 +54,14 @@ if command == 'codes.create'
|
|
78
54
|
exit 1
|
79
55
|
end
|
80
56
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
code = IronWorkerNG::Code::Creator.create(:name => name) do
|
85
|
-
execute_features.each do |f|
|
86
|
-
send(f[:name], *f[:args])
|
87
|
-
end
|
88
|
-
end
|
89
|
-
else
|
90
|
-
code = runtimes.find { |r| r[:name] == runtime }[:klass].new(:name => name)
|
57
|
+
if name.nil?
|
58
|
+
puts opts
|
59
|
+
exit 1
|
91
60
|
end
|
92
61
|
|
93
|
-
|
94
|
-
|
95
|
-
|
62
|
+
code = IronWorkerNG::Code::Base.new(name)
|
63
|
+
|
64
|
+
client = IronWorkerNG::Client.new
|
96
65
|
|
97
66
|
client.codes.create(code)
|
98
67
|
elsif command == 'tasks.create' || command == 'schedules.create'
|
@@ -185,6 +154,8 @@ elsif command == 'tasks.create' || command == 'schedules.create'
|
|
185
154
|
options[:run_every] = run_every unless run_every.nil?
|
186
155
|
end
|
187
156
|
|
157
|
+
client = IronWorkerNG::Client.new
|
158
|
+
|
188
159
|
id = nil
|
189
160
|
|
190
161
|
if command == 'tasks.create'
|
@@ -226,12 +197,14 @@ elsif command == 'tasks.log'
|
|
226
197
|
exit 1
|
227
198
|
end
|
228
199
|
|
200
|
+
client = IronWorkerNG::Client.new
|
201
|
+
|
229
202
|
log = ''
|
230
203
|
|
231
204
|
if live
|
232
205
|
begin
|
233
206
|
log = client.tasks.log(task_id)
|
234
|
-
rescue IronCore::
|
207
|
+
rescue IronCore::Error
|
235
208
|
end
|
236
209
|
else
|
237
210
|
log = client.tasks.log(task_id)
|
@@ -246,7 +219,7 @@ elsif command == 'tasks.log'
|
|
246
219
|
next_log = client.tasks.log(task_id)
|
247
220
|
print next_log[log.length .. - 1]
|
248
221
|
log = next_log
|
249
|
-
rescue IronCore::
|
222
|
+
rescue IronCore::Error
|
250
223
|
end
|
251
224
|
end
|
252
225
|
end
|
@@ -254,7 +227,7 @@ elsif command == 'tasks.log'
|
|
254
227
|
begin
|
255
228
|
next_log = client.tasks.log(task_id)
|
256
229
|
print next_log[log.length .. - 1]
|
257
|
-
rescue IronCore::
|
230
|
+
rescue IronCore::Error
|
258
231
|
end
|
259
232
|
end
|
260
233
|
end
|
@@ -7,19 +7,27 @@ module IronWorkerNG
|
|
7
7
|
AWS_US_EAST_HOST = 'worker-aws-us-east-1.iron.io'
|
8
8
|
|
9
9
|
def initialize(options = {})
|
10
|
-
|
10
|
+
default_options = {
|
11
|
+
:scheme => 'https',
|
12
|
+
:host => IronWorkerNG::APIClient::AWS_US_EAST_HOST,
|
13
|
+
:port => 443,
|
14
|
+
:api_version => 2,
|
15
|
+
:user_agent => IronWorkerNG.full_version
|
16
|
+
}
|
11
17
|
|
12
|
-
|
13
|
-
:scheme => 'https',
|
14
|
-
:host => IronWorkerNG::APIClient::AWS_US_EAST_HOST,
|
15
|
-
:port => 443,
|
16
|
-
:api_version => 2,
|
17
|
-
:user_agent => IronWorkerNG.full_version})
|
18
|
+
super('iron', 'worker', options, default_options, [:project_id, :token, :api_version])
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
IronCore::Logger.error 'IronWorkerNG', "Token is not set", IronCore::Error if @token.nil?
|
21
|
+
|
22
|
+
check_id(@project_id, 'project_id')
|
23
|
+
end
|
24
|
+
|
25
|
+
def headers
|
26
|
+
super.merge({'Authorization' => "OAuth #{@token}"})
|
27
|
+
end
|
28
|
+
|
29
|
+
def url
|
30
|
+
super + @api_version.to_s + '/'
|
23
31
|
end
|
24
32
|
|
25
33
|
def codes_list(options = {})
|
@@ -27,26 +35,26 @@ module IronWorkerNG
|
|
27
35
|
end
|
28
36
|
|
29
37
|
def codes_get(id)
|
30
|
-
|
38
|
+
check_id(id)
|
31
39
|
parse_response(get("projects/#{@project_id}/codes/#{id}"))
|
32
40
|
end
|
33
41
|
|
34
42
|
def codes_create(name, file, runtime, runner, options)
|
35
|
-
parse_response(post_file("projects/#{@project_id}/codes", File.new(file, 'rb'), {:name => name, :runtime => runtime, :file_name => runner}.merge(options)))
|
43
|
+
parse_response(post_file("projects/#{@project_id}/codes", :file, File.new(file, 'rb'), :data, {:name => name, :runtime => runtime, :file_name => runner}.merge(options)))
|
36
44
|
end
|
37
45
|
|
38
46
|
def codes_delete(id)
|
39
|
-
|
47
|
+
check_id(id)
|
40
48
|
parse_response(delete("projects/#{@project_id}/codes/#{id}"))
|
41
49
|
end
|
42
50
|
|
43
51
|
def codes_revisions(id, options = {})
|
44
|
-
|
52
|
+
check_id(id)
|
45
53
|
parse_response(get("projects/#{@project_id}/codes/#{id}/revisions", options))
|
46
54
|
end
|
47
55
|
|
48
56
|
def codes_download(id, options = {})
|
49
|
-
|
57
|
+
check_id(id)
|
50
58
|
parse_response(get("projects/#{@project_id}/codes/#{id}/download", options), false)
|
51
59
|
end
|
52
60
|
|
@@ -55,7 +63,7 @@ module IronWorkerNG
|
|
55
63
|
end
|
56
64
|
|
57
65
|
def tasks_get(id)
|
58
|
-
|
66
|
+
check_id(id)
|
59
67
|
parse_response(get("projects/#{@project_id}/tasks/#{id}"))
|
60
68
|
end
|
61
69
|
|
@@ -64,22 +72,22 @@ module IronWorkerNG
|
|
64
72
|
end
|
65
73
|
|
66
74
|
def tasks_cancel(id)
|
67
|
-
|
75
|
+
check_id(id)
|
68
76
|
parse_response(post("projects/#{@project_id}/tasks/#{id}/cancel"))
|
69
77
|
end
|
70
78
|
|
71
79
|
def tasks_cancel_all(code_id)
|
72
|
-
|
80
|
+
check_id(id)
|
73
81
|
parse_response(post("projects/#{@project_id}/codes/#{code_id}/cancel_all"))
|
74
82
|
end
|
75
83
|
|
76
84
|
def tasks_log(id)
|
77
|
-
|
85
|
+
check_id(id)
|
78
86
|
parse_response(get("projects/#{@project_id}/tasks/#{id}/log"), false)
|
79
87
|
end
|
80
88
|
|
81
89
|
def tasks_set_progress(id, options = {})
|
82
|
-
|
90
|
+
check_id(id)
|
83
91
|
parse_response(post("projects/#{@project_id}/tasks/#{id}/progress", options))
|
84
92
|
end
|
85
93
|
|
@@ -88,18 +96,19 @@ module IronWorkerNG
|
|
88
96
|
end
|
89
97
|
|
90
98
|
def schedules_get(id)
|
91
|
-
|
99
|
+
check_id(id)
|
92
100
|
parse_response(get("projects/#{@project_id}/schedules/#{id}"))
|
93
101
|
end
|
94
102
|
|
95
103
|
def schedules_create(code_name, payload, options = {})
|
96
|
-
options[:start_at] = options[:start_at].iso8601 if (not options[:start_at].nil?) && options[:start_at].
|
97
|
-
options[:end_at] = options[:end_at].iso8601 if (not options[:end_at].nil?) && options[:end_at].
|
104
|
+
options[:start_at] = options[:start_at].iso8601 if (not options[:start_at].nil?) && options[:start_at].respond_to?(:iso8601)
|
105
|
+
options[:end_at] = options[:end_at].iso8601 if (not options[:end_at].nil?) && options[:end_at].respond_to?(:iso8601)
|
98
106
|
|
99
107
|
parse_response(post("projects/#{@project_id}/schedules", {:schedules => [{:code_name => code_name, :payload => payload}.merge(options)]}))
|
100
108
|
end
|
101
109
|
|
102
110
|
def schedules_cancel(id)
|
111
|
+
check_id(id)
|
103
112
|
parse_response(post("projects/#{@project_id}/schedules/#{id}/cancel"))
|
104
113
|
end
|
105
114
|
end
|
@@ -16,7 +16,7 @@ module IronWorkerNG
|
|
16
16
|
if @client.respond_to?(full_name)
|
17
17
|
@client.send(full_name, *args, &block)
|
18
18
|
else
|
19
|
-
super
|
19
|
+
super(name, *args, &block)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -44,36 +44,43 @@ module IronWorkerNG
|
|
44
44
|
if args.length == 0
|
45
45
|
IronWorkerNG::ClientProxyCaller.new(self, name)
|
46
46
|
else
|
47
|
-
super
|
47
|
+
super(name, *args, &block)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
def codes_list(options = {})
|
52
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling codes.list with options='#{options.to_s}'"
|
53
|
+
|
52
54
|
@api.codes_list(options)['codes'].map { |c| OpenStruct.new(c) }
|
53
55
|
end
|
54
56
|
|
55
57
|
def codes_get(code_id)
|
58
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling codes.get with code_id='#{code_id}'"
|
59
|
+
|
56
60
|
OpenStruct.new(@api.codes_get(code_id))
|
57
61
|
end
|
58
62
|
|
59
63
|
def codes_create(code, options = {})
|
64
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling codes.create with code='#{code.to_s}' and options='#{options.to_s}'"
|
65
|
+
|
60
66
|
zip_file = code.create_zip
|
61
67
|
|
62
68
|
if code.remote_build_command.nil?
|
63
69
|
res = @api.codes_create(code.name, zip_file, 'sh', '__runner__.sh', options)
|
64
70
|
else
|
65
|
-
builder_code_name = code.name + 'Builder'
|
71
|
+
builder_code_name = code.name + (code.name.capitalize == code.name ? '::Builder' : '::builder')
|
66
72
|
|
67
73
|
@api.codes_create(builder_code_name, zip_file, 'sh', '__runner__.sh', options)
|
68
74
|
|
69
|
-
|
70
|
-
|
75
|
+
builder_task = tasks.create(builder_code_name, :code_name => code.name, :client_options => @api.options.to_json, :codes_create_options => options.to_json)
|
76
|
+
builder_task = tasks.wait_for(builder_task.id)
|
71
77
|
|
72
|
-
|
73
|
-
|
78
|
+
unless builder_task.status == 'complete'
|
79
|
+
log = tasks.log(builder_task.id)
|
80
|
+
IronCore::Logger.error 'IronWorkerNG', 'Error while remote building worker: ' + log, IronCore::Error
|
74
81
|
end
|
75
82
|
|
76
|
-
res = JSON.parse(
|
83
|
+
res = JSON.parse(builder_task.msg)
|
77
84
|
end
|
78
85
|
|
79
86
|
File.unlink(zip_file)
|
@@ -82,62 +89,86 @@ module IronWorkerNG
|
|
82
89
|
end
|
83
90
|
|
84
91
|
def codes_delete(code_id)
|
92
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling codes.delete with code_id='#{code_id}'"
|
93
|
+
|
85
94
|
@api.codes_delete(code_id)
|
86
95
|
|
87
96
|
true
|
88
97
|
end
|
89
98
|
|
90
99
|
def codes_revisions(code_id, options = {})
|
100
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling codes.revisions with code_id='#{code_id}' and options='#{options.to_s}'"
|
101
|
+
|
91
102
|
@api.codes_revisions(code_id, options)['revisions'].map { |c| OpenStruct.new(c) }
|
92
103
|
end
|
93
104
|
|
94
105
|
def codes_download(code_id, options = {})
|
106
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling codes.download with code_id='#{code_id}' and options='#{options.to_s}'"
|
107
|
+
|
95
108
|
@api.codes_download(code_id, options)
|
96
109
|
end
|
97
110
|
|
98
111
|
def tasks_list(options = {})
|
112
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling tasks.list with options='#{options.to_s}'"
|
113
|
+
|
99
114
|
@api.tasks_list(options)['tasks'].map { |t| OpenStruct.new(t) }
|
100
115
|
end
|
101
116
|
|
102
117
|
def tasks_get(task_id)
|
118
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling tasks.get with task_id='#{task_id}'"
|
119
|
+
|
103
120
|
OpenStruct.new(@api.tasks_get(task_id))
|
104
121
|
end
|
105
122
|
|
106
123
|
def tasks_create(code_name, params = {}, options = {})
|
124
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling tasks.create with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
|
125
|
+
|
107
126
|
res = @api.tasks_create(code_name, params.class == String ? params : params.to_json, options)
|
108
127
|
|
109
128
|
OpenStruct.new(res['tasks'][0])
|
110
129
|
end
|
111
130
|
|
112
131
|
def tasks_create_legacy(code_name, params = {}, options = {})
|
132
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling tasks.create_legacy with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
|
133
|
+
|
113
134
|
res = @api.tasks_create(code_name, params_for_legacy(code_name, params), options)
|
114
135
|
|
115
136
|
OpenStruct.new(res['tasks'][0])
|
116
137
|
end
|
117
138
|
|
118
139
|
def tasks_cancel(task_id)
|
140
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling tasks.cancel with task_id='#{task_id}'"
|
141
|
+
|
119
142
|
@api.tasks_cancel(task_id)
|
120
143
|
|
121
144
|
true
|
122
145
|
end
|
123
146
|
|
124
147
|
def tasks_cancel_all(code_id)
|
148
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling tasks.cancel_all with code_id='#{code_id}'"
|
149
|
+
|
125
150
|
@api.tasks_cancel_all(code_id)
|
126
151
|
|
127
152
|
true
|
128
153
|
end
|
129
154
|
|
130
155
|
def tasks_log(task_id)
|
156
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling tasks.log with task_id='#{task_id}'"
|
157
|
+
|
131
158
|
@api.tasks_log(task_id)
|
132
159
|
end
|
133
160
|
|
134
161
|
def tasks_set_progress(task_id, options = {})
|
162
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling tasks.set_progress with task_id='#{task_id}' and options='#{options.to_s}'"
|
163
|
+
|
135
164
|
@api.tasks_set_progress(task_id, options)
|
136
165
|
|
137
166
|
true
|
138
167
|
end
|
139
168
|
|
140
169
|
def tasks_wait_for(task_id, options = {})
|
170
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling tasks.wait_for with task_id='#{task_id}' and options='#{options.to_s}'"
|
171
|
+
|
141
172
|
options[:sleep] ||= options['sleep'] || 5
|
142
173
|
|
143
174
|
task = tasks_get(task_id)
|
@@ -152,33 +183,41 @@ module IronWorkerNG
|
|
152
183
|
end
|
153
184
|
|
154
185
|
def schedules_list(options = {})
|
186
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling schedules.list with options='#{options.to_s}'"
|
187
|
+
|
155
188
|
@api.schedules_list(options)['schedules'].map { |s| OpenStruct.new(s) }
|
156
189
|
end
|
157
190
|
|
158
191
|
def schedules_get(schedule_id)
|
192
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling schedules.get with schedule_id='#{schedule_id}"
|
193
|
+
|
159
194
|
OpenStruct.new(@api.schedules_get(schedule_id))
|
160
195
|
end
|
161
196
|
|
162
197
|
def schedules_create(code_name, params = {}, options = {})
|
198
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling schedules.create with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
|
199
|
+
|
163
200
|
res = @api.schedules_create(code_name, params.class == String ? params : params.to_json, options)
|
164
201
|
|
165
202
|
OpenStruct.new(res['schedules'][0])
|
166
203
|
end
|
167
204
|
|
168
205
|
def schedules_create_legacy(code_name, params = {}, options = {})
|
206
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling schedules.create_legacy with code_name='#{code_name}', params='#{params.to_s}' and options='#{options.to_s}'"
|
207
|
+
|
169
208
|
res = @api.schedules_create(code_name, params_for_legacy(code_name, params), options)
|
170
209
|
|
171
210
|
OpenStruct.new(res['schedules'][0])
|
172
211
|
end
|
173
212
|
|
174
213
|
def schedules_cancel(schedule_id)
|
214
|
+
IronCore::Logger.info 'IronWorkerNG', "Calling schedules.cancel with schedule_id='#{schedule_id}"
|
215
|
+
|
175
216
|
@api.schedules_cancel(schedule_id)
|
176
217
|
|
177
218
|
true
|
178
219
|
end
|
179
220
|
|
180
|
-
private
|
181
|
-
|
182
221
|
def params_for_legacy(code_name, params)
|
183
222
|
if params.class == String
|
184
223
|
params = JSON.parse(params)
|