datahen 0.10.4 → 0.11.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.
- checksums.yaml +4 -4
- data/lib/datahen/cli/scraper.rb +16 -0
- data/lib/datahen/client/base.rb +3 -0
- data/lib/datahen/client/job_stat.rb +8 -1
- data/lib/datahen/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d6c3a633e605f0c40a8c404f4bb2bb3c2b10aef8e6d7dec88d5a183687c056f0
|
|
4
|
+
data.tar.gz: 3d5a46ee42a099cf53d2f24187fb8115d94732cfe656db352e4cf05d31c83bfa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7bd9f1d9d8a5b8b18e1658318738d75ea570ff4d400c1213eda504d3b2d2effc40c751923097671bc20407f33be80dd5d013f0f354cde714f974267fcf5a79dd
|
|
7
|
+
data.tar.gz: 268295cdb7787776216fba2a18d0941162c05caaa6db346e3d39f4a51c03def0ac9209724b8d06b4d21629c007fc31d22cab7f40f8df745fac92513c46736118
|
data/lib/datahen/cli/scraper.rb
CHANGED
|
@@ -150,7 +150,23 @@ module Datahen
|
|
|
150
150
|
else
|
|
151
151
|
puts "#{client.scraper_job_current_stats(scraper_name)}"
|
|
152
152
|
end
|
|
153
|
+
end
|
|
153
154
|
|
|
155
|
+
desc "history <scraper_name>", "Get historic stats for a job"
|
|
156
|
+
long_desc <<-LONGDESC
|
|
157
|
+
Get historic stats for a scraper's current job\n
|
|
158
|
+
LONGDESC
|
|
159
|
+
option :job, :aliases => :j, type: :numeric, desc: 'Set a specific job ID'
|
|
160
|
+
option :"min-timestamp", type: :string, desc: 'Starting timestamp point in time to query historic stats (inclusive)'
|
|
161
|
+
option :"max-timestamp", type: :string, desc: 'Ending timestamp point in time to query historic stats (inclusive)'
|
|
162
|
+
option :"limit", type: :numeric, desc: 'Limit stats retrieved.'
|
|
163
|
+
def history(scraper_name)
|
|
164
|
+
client = Client::JobStat.new(options)
|
|
165
|
+
if options[:job]
|
|
166
|
+
puts "#{client.job_stats_history(options[:job])}"
|
|
167
|
+
else
|
|
168
|
+
puts "#{client.scraper_job_stats_history(scraper_name)}"
|
|
169
|
+
end
|
|
154
170
|
end
|
|
155
171
|
|
|
156
172
|
|
data/lib/datahen/client/base.rb
CHANGED
|
@@ -51,6 +51,9 @@ module Datahen
|
|
|
51
51
|
query[:status] = opts[:status] if opts[:status]
|
|
52
52
|
query[:page_type] = opts[:page_type] if opts[:page_type]
|
|
53
53
|
query[:gid] = opts[:gid] if opts[:gid]
|
|
54
|
+
query[:"min-timestamp"] = opts[:"min-timestamp"]
|
|
55
|
+
query[:"max-timestamp"] = opts[:"max-timestamp"]
|
|
56
|
+
query[:limit] = opts[:limit]
|
|
54
57
|
|
|
55
58
|
if opts[:query]
|
|
56
59
|
if opts[:query].is_a?(Hash)
|
|
@@ -10,7 +10,14 @@ module Datahen
|
|
|
10
10
|
self.class.get("/scrapers/#{scraper_name}/current_job/stats/current", @options)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
def job_stats_history(job_id)
|
|
14
|
+
self.class.get("/jobs/#{job_id}/stats/history", @options)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def scraper_job_stats_history(scraper_name)
|
|
18
|
+
self.class.get("/scrapers/#{scraper_name}/current_job/stats/history", @options)
|
|
19
|
+
end
|
|
20
|
+
|
|
13
21
|
end
|
|
14
22
|
end
|
|
15
23
|
end
|
|
16
|
-
|
data/lib/datahen/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: datahen
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Parama Danoesubroto
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-01-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|
|
@@ -262,8 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
262
262
|
- !ruby/object:Gem::Version
|
|
263
263
|
version: '0'
|
|
264
264
|
requirements: []
|
|
265
|
-
|
|
266
|
-
rubygems_version: 2.7.6
|
|
265
|
+
rubygems_version: 3.0.3
|
|
267
266
|
signing_key:
|
|
268
267
|
specification_version: 4
|
|
269
268
|
summary: DataHen toolbelt for developers
|