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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19a6cfd035a3cd5ba9bd10c1cf34e6baa0590cb2f07664e2bdd3ee2f8e032ebf
4
- data.tar.gz: b7cd0aa204baa98013c5853df68b93eb8562c1b4c202bf65b8a3c931ca2135d1
3
+ metadata.gz: b3dc2db62e50655c78bb70aceac56a3f1fb3f8ec87d155c65bbaf4e521d10fc5
4
+ data.tar.gz: 57de5a7b0e9271dcfbb05d7ac22df37a127cd3c427e03d93bb448359b7d30edc
5
5
  SHA512:
6
- metadata.gz: 8ac98d022003ea6db219c1a07518f127bed088db30ebca3791569bd643acdf8ddc2ad01ddc553f42976a0a6983dfe2928fceadc2f91ed4464b4c2539939df28b
7
- data.tar.gz: 33a65a6ffe29cb8ab0e75283436909f683354365a07e11ee672fac4311367ec55c31d2db6e8bcc02de0569768169360fb2120d4e6149aae8e0151cabea8b6752
6
+ metadata.gz: 73888c3cabdb2c4f20371fff2f73294a71eb105a282ffff9e85ab675865fe1a7ffd8efb768cd8f0e82667158b6c249bbfef0f883088538dfc1c2c1fc4cdab527
7
+ data.tar.gz: e15616500c7994d3c537b42c38dd4965035f7ef825181053ad05ece46a42194d8574c322ec3f3e24121ca0c7aac2c4a9351cd93dff64814855500b04a536d61d
@@ -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
 
@@ -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
@@ -16,7 +16,7 @@ module Datahen
16
16
  role: role,
17
17
  description: description}
18
18
 
19
- params = @options.merge({body: body.to_json})
19
+ params = @options.merge({body: body.to_json}).merge(opts)
20
20
  self.class.post("/auth_tokens", params)
21
21
  end
22
22
 
@@ -71,6 +71,11 @@ module Datahen
71
71
  self.class.get("/jobs/#{job_id}/profile", params)
72
72
  end
73
73
 
74
+ def delete(job_id, opts={})
75
+ params = @options.merge(opts)
76
+ self.class.delete("/jobs/#{job_id}", params)
77
+ end
78
+
74
79
  end
75
80
 
76
81
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Datahen
2
- VERSION = "0.14.12"
2
+ VERSION = "0.14.15"
3
3
  end
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.12
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-09-01 00:00:00.000000000 Z
11
+ date: 2020-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor