datahen 0.14.12 → 0.14.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/datahen/cli/job.rb +1 -3
- data/lib/datahen/cli/scraper.rb +2 -0
- data/lib/datahen/cli/scraper_job.rb +15 -0
- data/lib/datahen/client/auth_token.rb +1 -1
- data/lib/datahen/client/job.rb +5 -0
- data/lib/datahen/client/scraper.rb +2 -0
- data/lib/datahen/client/scraper_job.rb +5 -0
- data/lib/datahen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3dc2db62e50655c78bb70aceac56a3f1fb3f8ec87d155c65bbaf4e521d10fc5
|
4
|
+
data.tar.gz: 57de5a7b0e9271dcfbb05d7ac22df37a127cd3c427e03d93bb448359b7d30edc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73888c3cabdb2c4f20371fff2f73294a71eb105a282ffff9e85ab675865fe1a7ffd8efb768cd8f0e82667158b6c249bbfef0f883088538dfc1c2c1fc4cdab527
|
7
|
+
data.tar.gz: e15616500c7994d3c537b42c38dd4965035f7ef825181053ad05ece46a42194d8574c322ec3f3e24121ca0c7aac2c4a9351cd93dff64814855500b04a536d61d
|
data/lib/datahen/cli/job.rb
CHANGED
@@ -6,7 +6,6 @@ module Datahen
|
|
6
6
|
"#{basename} #{@package_name} #{command.usage}"
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
9
|
desc "list", "gets a list of jobs"
|
11
10
|
option :page, :aliases => :p, type: :numeric, desc: 'Get the next set of records by page.'
|
12
11
|
option :per_page, :aliases => :P, type: :numeric, desc: 'Number of records per page. Max 500 per page.'
|
@@ -35,8 +34,7 @@ module Datahen
|
|
35
34
|
client = Client::JobStat.new(options)
|
36
35
|
puts "#{client.job_current_stats(job_id, options)}"
|
37
36
|
end
|
38
|
-
|
39
|
-
|
37
|
+
|
40
38
|
end
|
41
39
|
end
|
42
40
|
|
data/lib/datahen/cli/scraper.rb
CHANGED
@@ -31,6 +31,7 @@ module Datahen
|
|
31
31
|
option :timezone, type: :string, desc: "Set the scheduler's timezone. Must be in IANA Timezone format. Defaults to \"America/Toronto\""
|
32
32
|
option :profile, type: :string, desc: 'Set the profiles (comma separated) to apply to the job. Default: default'
|
33
33
|
option :multiple_jobs, type: :boolean, desc: 'Set true to enable multiple jobs. Default: false'
|
34
|
+
option :max_job_count, type: :numeric, desc: 'Set a value to set max number of jobs available. Set -1 for unlimited. Default: 3'
|
34
35
|
def create(scraper_name, git_repository)
|
35
36
|
# puts "options #{options}"
|
36
37
|
client = Client::Scraper.new(options)
|
@@ -55,6 +56,7 @@ module Datahen
|
|
55
56
|
option :timezone, type: :string, desc: "Set the scheduler's timezone. Must be in IANA Timezone format. Defaults to \"America/Toronto\""
|
56
57
|
option :profile, type: :string, desc: 'Set the profiles (comma separated) to apply to the job. Default: default'
|
57
58
|
option :multiple_jobs, type: :boolean, desc: 'Set true to enable multiple jobs. Default: false'
|
59
|
+
option :max_job_count, type: :numeric, desc: 'Set a value to set max number of jobs available. Set -1 for unlimited. Default: 3'
|
58
60
|
def update(scraper_name)
|
59
61
|
client = Client::Scraper.new(options)
|
60
62
|
puts "#{client.update(scraper_name, options)}"
|
@@ -48,6 +48,21 @@ module Datahen
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
desc "delete <scraper_name>", "delete a scraper's current job"
|
52
|
+
long_desc <<-LONGDESC
|
53
|
+
Delete a scraper's current job
|
54
|
+
LONGDESC
|
55
|
+
option :job, :aliases => :j, type: :numeric, desc: 'Set a specific job ID'
|
56
|
+
def delete(scraper_name)
|
57
|
+
if options[:job]
|
58
|
+
client = Client::Job.new(options)
|
59
|
+
puts "#{client.delete(options[:job])}"
|
60
|
+
else
|
61
|
+
client = Client::ScraperJob.new(options)
|
62
|
+
puts "#{client.delete(scraper_name)}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
51
66
|
desc "resume <scraper_name>", "resumes a scraper's current job"
|
52
67
|
long_desc <<-LONGDESC
|
53
68
|
Resumes a scraper's current job
|
data/lib/datahen/client/job.rb
CHANGED
@@ -27,6 +27,7 @@ module Datahen
|
|
27
27
|
body[:timezone] = opts[:timezone] if opts[:timezone]
|
28
28
|
body[:profile] = opts[:profile] if opts[:profile]
|
29
29
|
body[:multiple_jobs] = opts[:multiple_jobs] if opts[:multiple_jobs]
|
30
|
+
body[:max_job_count] = opts[:max_job_count] if opts[:max_job_count]
|
30
31
|
params = @options.merge({body: body.to_json})
|
31
32
|
self.class.post("/scrapers", params)
|
32
33
|
end
|
@@ -47,6 +48,7 @@ module Datahen
|
|
47
48
|
body[:timezone] = opts[:timezone] if opts[:timezone]
|
48
49
|
body[:profile] = opts[:profile] if opts[:profile]
|
49
50
|
body[:multiple_jobs] = opts[:multiple_jobs] if opts.has_key?("multiple_jobs") || opts.has_key?(:multiple_jobs)
|
51
|
+
body[:max_job_count] = opts[:max_job_count] if opts.has_key?("max_job_count") || opts.has_key?(:max_job_count)
|
50
52
|
params = @options.merge({body: body.to_json})
|
51
53
|
|
52
54
|
self.class.put("/scrapers/#{scraper_name}", params)
|
@@ -55,6 +55,11 @@ module Datahen
|
|
55
55
|
|
56
56
|
self.class.get("/scrapers/#{scraper_name}/current_job/profile", params)
|
57
57
|
end
|
58
|
+
|
59
|
+
def delete(scraper_name, opts={})
|
60
|
+
params = @options.merge(opts)
|
61
|
+
self.class.delete("/scrapers/#{scraper_name}/current_job", params)
|
62
|
+
end
|
58
63
|
end
|
59
64
|
end
|
60
65
|
end
|
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.14.
|
4
|
+
version: 0.14.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Parama Danoesubroto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|