pampa_workers 1.1.36 → 1.1.39

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: 3175ade5d17fb0108641063b707974f68e2874cb
4
+ data.tar.gz: 573c5ce2ba81f42174b605690a92578362b1b2ac
5
5
  SHA512:
6
- metadata.gz: 7f9bd559b88b0a324fd7d7831dfcea10dcf40e69b3e373f13140ac47402d6b29debcfdd173dfb44b71c83214ce1af24d11961406a27d9164d48565d9cb76abf7
7
- data.tar.gz: 25a3991d9d809e79f88b67d1ed0b39d0b5507dce936b13ae05890371215574cf7008907950f43f3ed37a29c9f631276e002833122d17c6e221efb4195f589a52
6
+ metadata.gz: 0d44ac6a3c807cb5c9d790f9aad8ad12f59e976d02794ec54ca6b6dfd51f309ad134a8cb1257c36b26f124f86f9f9c4b511bee5e0d1f2c6e6faae0d9063db615
7
+ data.tar.gz: bd07fdafd4e338b32720feb83fe436242f8d765e3616a4cac985d1597026ff4f5b811d008068a5eb240c945d0333687af5072bd2142a4d7f518f3ad55b64fb0c
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, url=nil, assigned_process=nil)
36
+ url = !url.nil? ? url : "#{BlackStack::Pampa::api_protocol}://#{self.ws_url}:#{self.ws_port}/api1.3/bots/boterror.json"
37
+ # subo el error
38
+ nTries = 0
39
+ bSuccess = false
40
+ parsed = nil
41
+ sError = ""
42
+ while (nTries < 5 && bSuccess == false)
43
+ begin
44
+ nTries = nTries + 1
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
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.39
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