pampa_workers 1.1.36 → 1.1.37

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bf333066f1f470e6be3f9c4519ff360f96965f2
4
- data.tar.gz: aef33683462202e1e350762e7209cece54f27ffc
3
+ metadata.gz: acfb10a1b7c85ff28da7bd78336fb50bd1bab2fd
4
+ data.tar.gz: 88b45ef4d3e3766cc6e6fb5cab4de98aed251196
5
5
  SHA512:
6
- metadata.gz: 7f9bd559b88b0a324fd7d7831dfcea10dcf40e69b3e373f13140ac47402d6b29debcfdd173dfb44b71c83214ce1af24d11961406a27d9164d48565d9cb76abf7
7
- data.tar.gz: 25a3991d9d809e79f88b67d1ed0b39d0b5507dce936b13ae05890371215574cf7008907950f43f3ed37a29c9f631276e002833122d17c6e221efb4195f589a52
6
+ metadata.gz: 12257f58a67f506832dcd5907b7eccf3b710b03d729955f05774ca9c0c4d1160c0d87487514691e2618b9cda2de735bc9aba18e6bf59764b3dacd049ab52ca3c
7
+ data.tar.gz: 3ddb29b711b144b64d0fa0801c059940976a7925bb6b28015c6bdd1bf26d3897df08be076cb12fcd9b9171d9a0521349410e6a7392d6486f681dd21dee5f4062
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)
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' => 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
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.36
4
+ version: 1.1.37
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