meer 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/meer.rb +1 -0
- data/lib/meer/cli.rb +23 -0
- data/lib/meer/datameer.rb +13 -0
- data/lib/meer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e74d2cf311f4c0a2c7f8def9ee3d016f42bd864a
|
4
|
+
data.tar.gz: b850a87d8f329d219d32cef374b484ede546a736
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d7a5fd6eb509903084062376b569b72633444b5ec64455044670cec567637bf7f9aefd15fd603efa49140fb178b09a02a5c45a55d509af5feee93aaf3a7d942
|
7
|
+
data.tar.gz: 9cfdf9544230e96f645152ab619454d32c4582c53acfe078c2015837c7534e8d69451afdcc264f08b9f6e3e50c6af300216d5a5c2c88322c5c096792e7036ba3
|
data/README.md
CHANGED
@@ -14,12 +14,13 @@ Meer pulls the base url for what datameer to hit from environment variables, so
|
|
14
14
|
|
15
15
|
``` shell
|
16
16
|
$ meer help
|
17
|
-
|
18
17
|
Commands:
|
19
18
|
meer csv [WORKBOOK-ID] [SHEET_NAME] # Outputs the CSV for a given workbook
|
20
19
|
meer help [COMMAND] # Describe available commands or one specific command
|
20
|
+
meer jobs # Lists all currently running jobs
|
21
21
|
meer login # Logs into datameer for quick access
|
22
22
|
meer sheets [WORKBOOK-ID] # Lists all sheets in a workbook
|
23
|
+
meer start [WORKBOOK-ID] # Trigger a run of a workbook
|
23
24
|
meer table [WORKBOOK-ID] [SHEET_NAME] # Outputs a nicely formatted table for a given workbook
|
24
25
|
meer workbooks # Lists all workbooks
|
25
26
|
```
|
data/lib/meer.rb
CHANGED
data/lib/meer/cli.rb
CHANGED
@@ -46,6 +46,29 @@ module Meer
|
|
46
46
|
puts Terminal::Table.new(headings: headers, rows: rows)
|
47
47
|
end
|
48
48
|
|
49
|
+
desc 'start [WORKBOOK-ID]', 'Trigger a run of a workbook'
|
50
|
+
def start(wb_id)
|
51
|
+
puts client.run_workbook(wb_id).to_yaml
|
52
|
+
end
|
53
|
+
|
54
|
+
JOB_HEADERS = %w(startTime jobStatus dapJobConfigurationId jobExecutionId progress estimateTime)
|
55
|
+
|
56
|
+
desc 'jobs', 'Lists all currently running jobs'
|
57
|
+
option :workbook, type: :numeric, aliases: :w
|
58
|
+
option :job, type: :numeric, aliases: :j
|
59
|
+
def jobs
|
60
|
+
data = client.running_jobs
|
61
|
+
|
62
|
+
rows = if data.size > 0
|
63
|
+
data.select!{|r| r['dapJobConfigurationId'].to_i == options[:workbook] } if options[:workbook]
|
64
|
+
data.select!{|r| r['jobExecutionId'].to_i == options[:job] } if options[:job]
|
65
|
+
data.sort_by {|r| -r['progress'].to_i }.map { |r| JOB_HEADERS.map{|k| r[k]} }
|
66
|
+
else
|
67
|
+
[]
|
68
|
+
end
|
69
|
+
|
70
|
+
puts Terminal::Table.new(headings: JOB_HEADERS, rows: rows)
|
71
|
+
end
|
49
72
|
|
50
73
|
private
|
51
74
|
|
data/lib/meer/datameer.rb
CHANGED
@@ -32,6 +32,11 @@ module Meer
|
|
32
32
|
req = Net::HTTP::Get.new(URI(uri.to_s + url))
|
33
33
|
request(req)
|
34
34
|
end
|
35
|
+
|
36
|
+
def post url
|
37
|
+
req = Net::HTTP::Post.new(URI(uri.to_s + url))
|
38
|
+
request(req)
|
39
|
+
end
|
35
40
|
|
36
41
|
|
37
42
|
def login
|
@@ -59,6 +64,14 @@ module Meer
|
|
59
64
|
JSON.parse(get("/rest/workbook").body)
|
60
65
|
end
|
61
66
|
|
67
|
+
def run_workbook wb_id
|
68
|
+
JSON.parse post("/rest/job-execution?configuration=#{wb_id}").body
|
69
|
+
end
|
70
|
+
|
71
|
+
def running_jobs
|
72
|
+
JSON.parse get("/rest/jobs/list-running").body
|
73
|
+
end
|
74
|
+
|
62
75
|
module Session
|
63
76
|
SESSION_FILE = File.expand_path('~/.dmsession')
|
64
77
|
|
data/lib/meer/version.rb
CHANGED