pampa_workers 1.1.35 → 1.1.38

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84dd33be7f455c020f37d956ac92a489d8c5e358
4
- data.tar.gz: 461788a7bd17a559d60fdcee7204903183e6c2ea
3
+ metadata.gz: 887da76a0bf744fe632b6b1ebb7c8504984fe414
4
+ data.tar.gz: 20f9be7dc2c498c64db9138a1688bd6a58e7a13f
5
5
  SHA512:
6
- metadata.gz: b6b4b6d6d2f156d8c6fa2e1a647f6f0d7c55031477cce3e08d146fa2bc2213bf21c56868303edfe1171bf86a26f8341c78ea7405751dfaac055b762e178fb36b
7
- data.tar.gz: c69bacd4f7437b41b2830c469bfba8a2c46b4b83bb1f1689f9d967c8e64f1f951daf62cf9dca80b4cc9a619753dc490d155265ac5d55e2aeef8d88911828d1e7
6
+ metadata.gz: e752d3dc296bce618dce42c287380d0cca27d2bc61e029c7baa82712ac814bae2d20d2b80d9b0622b6fb2cf02081a9fa34c339ff3f5160d75d6226e362e59937
7
+ data.tar.gz: 03e992bd884db3034352d12e28991a3caa0609c653ebd3fc6c551ae11004867abac86d06af10ea67bb20944f047d534386c3014e3045dea50857afb12721010e
data/lib/client.rb CHANGED
@@ -30,6 +30,7 @@ module BlackStack
30
30
  end
31
31
 
32
32
  # returns the hosts belong this client
33
+ # TODO: deprecated
33
34
  def own_hosts()
34
35
  BlackStack::LocalHost.where(:id_client=>self.id, :delete_time=>nil)
35
36
  end
@@ -4,6 +4,6 @@ module BlackStack
4
4
  # en cada iteracion saluda a la central (hello), obtiene parametros (get)
5
5
  class MyChildProcess < BlackStack::MyProcess
6
6
 
7
- end # MyChildProcess
7
+ end # class MyChildProcess
8
8
 
9
9
  end # module BlackStack
data/lib/myprocess.rb CHANGED
@@ -27,6 +27,48 @@ module BlackStack
27
27
  self.password = the_password
28
28
  end
29
29
 
30
+ # Sube un registro a la tabla boterrorlog, con el id del worker, el proceso asignado, on id de objeto relacionado (opcional) y un screenshot (opcional).
31
+ #
32
+ # uid: id de un registro en la tabla lnuser.
33
+ # description: backtrace de la excepcion.
34
+ #
35
+ def notifyError(uid, description, oid=nil, screenshot_file=nil, assigned_process=nil)
36
+ # subo el error
37
+ nTries = 0
38
+ bSuccess = false
39
+ parsed = nil
40
+ sError = ""
41
+ while (nTries < 5 && bSuccess == false)
42
+ begin
43
+ nTries = nTries + 1
44
+ url = "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/bots/boterror.json"
45
+ res = BlackStack::Netting::call_post(url, # TODO: migrar a RestClient para poder hacer file upload
46
+ 'api_key' => BlackStack::Pampa::api_key,
47
+ 'id_lnuser' => uid,
48
+ 'id_object' => oid,
49
+ 'worker_name' => PROCESS.fullWorkerName,
50
+ 'process' => !assigned_process.nil? ? assigned_process : PROCESS.worker.assigned_process,
51
+ 'description' => description,
52
+ 'screenshot' => screenshot_file,
53
+ )
54
+ parsed = JSON.parse(res.body)
55
+ if (parsed['status']=='success')
56
+ bSuccess = true
57
+ else
58
+ sError = parsed['status']
59
+ end
60
+ rescue Errno::ECONNREFUSED => e
61
+ sError = "Errno::ECONNREFUSED:" + e.to_console
62
+ rescue => e2
63
+ sError = "Exception:" + e2.to_console
64
+ end
65
+ end # while
66
+
67
+ if (bSuccess==false)
68
+ raise "#{sError}"
69
+ end
70
+ end
71
+
30
72
  # retrieves the id of the current process
31
73
  def pid()
32
74
  Process.pid.to_s
@@ -127,11 +169,11 @@ module BlackStack
127
169
  def get()
128
170
  # me notifico a la central. obtengo asignacion que tenga
129
171
  url = "#{BlackStack::Pampa::api_url}/api1.3/pampa/get.json"
130
- puts
131
- puts
132
- puts "url: #{url}"
133
- puts
134
- puts
172
+ #puts
173
+ #puts
174
+ #puts "url: #{url}"
175
+ #puts
176
+ #puts
135
177
  res = BlackStack::Netting::call_post(url, {
136
178
  'api_key' => BlackStack::Pampa::api_key,
137
179
  'name' => self.fullWorkerName }.merge( BlackStack::RemoteHost.new.poll )
@@ -219,11 +261,11 @@ puts
219
261
 
220
262
  # me notifico a la division. obtengo trabajo
221
263
  url = "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/pampa/notify.json"
222
- puts
223
- puts
224
- puts "url: #{url}"
225
- puts
226
- puts
264
+ #puts
265
+ #puts
266
+ #puts "url: #{url}"
267
+ #puts
268
+ #puts
227
269
  res = BlackStack::Netting::call_post(url,
228
270
  {
229
271
  'api_key' => BlackStack::Pampa::api_key,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pampa_workers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.35
4
+ version: 1.1.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-28 00:00:00.000000000 Z
11
+ date: 2022-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket