gush-control 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gush/control/app.rb +11 -5
- data/lib/gush/control/assets/javascripts/application.coffee +4 -9
- data/lib/gush/control/assets/javascripts/gush.coffee +22 -10
- data/lib/gush/control/assets/javascripts/job.coffee +8 -1
- data/lib/gush/control/assets/stylesheets/app.css +0 -5
- data/lib/gush/control/version.rb +1 -1
- data/lib/gush/control/views/show.slim +5 -7
- 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: 0a589286bf32cc78c297cc5ec41a053dd9a9f97d
|
4
|
+
data.tar.gz: 3b524f58cd25e7e5db24aeecce402e4200681d77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdd3ac0e6ad2bb937b37638043ff4580cbd4a54a212ad967a1bd413fd0152467d977439f7d195bcc7f254469df7774c4e830e294a6a4411276c6cbe47b49d3f0
|
7
|
+
data.tar.gz: a2d95dec4e0ea270c4a824a37f52008980749e0cab33c5c286e799f800f2bb6b3a27c6afaed236007c5396a19bba90687f4227f9f5ff94f2e1707ae142505ebb
|
data/lib/gush/control/app.rb
CHANGED
@@ -96,11 +96,13 @@ module Gush
|
|
96
96
|
@workflow.jobs.each do |job|
|
97
97
|
name = job.class.to_s
|
98
98
|
@jobs << {
|
99
|
-
name:
|
100
|
-
finished:
|
101
|
-
|
102
|
-
|
103
|
-
|
99
|
+
name: name,
|
100
|
+
finished: job.finished?,
|
101
|
+
started_at: format_time(job.started_at),
|
102
|
+
finished_at: format_time(job.finished_at),
|
103
|
+
running: job.running?,
|
104
|
+
enqueued: job.enqueued?,
|
105
|
+
failed: job.failed?
|
104
106
|
}
|
105
107
|
|
106
108
|
if job.incoming.empty?
|
@@ -168,6 +170,10 @@ module Gush
|
|
168
170
|
Thread.current[:redis] ||= Redis.new(url: settings.client.configuration.redis_url)
|
169
171
|
end
|
170
172
|
|
173
|
+
def format_time(timestamp)
|
174
|
+
Time.at(timestamp) if timestamp
|
175
|
+
end
|
176
|
+
|
171
177
|
def remove_workflow_and_logs(workflow)
|
172
178
|
remove_workflow(workflow)
|
173
179
|
remove_logs(workflow)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
window.Gush = new Gush
|
2
|
+
|
2
3
|
$(document).ready ->
|
3
|
-
window.Gush.initialize()
|
4
|
+
window.Gush.initialize(jobs)
|
4
5
|
Foundation.global.namespace = ''
|
5
6
|
$(document).foundation()
|
6
7
|
|
@@ -38,17 +39,11 @@ $(document).ready ->
|
|
38
39
|
|
39
40
|
$(this).on "click", ".jobs-filter dd a", (event) ->
|
40
41
|
event.preventDefault()
|
41
|
-
filter = $(this).
|
42
|
-
table = $("table.nodes tbody")
|
43
|
-
|
42
|
+
filter = $(this).data('filter')
|
44
43
|
$(this).closest('dl').find('dd').removeClass('active')
|
45
44
|
$(this).parent().addClass('active')
|
45
|
+
Gush.filterJobs(filter)
|
46
46
|
|
47
|
-
table.find("tr").hide()
|
48
|
-
if filter == "all"
|
49
|
-
table.find("tr").show()
|
50
|
-
else
|
51
|
-
table.find("tr.#{filter}").show()
|
52
47
|
|
53
48
|
$(this).on "click", "a.remove-completed", (event) ->
|
54
49
|
event.preventDefault()
|
@@ -3,10 +3,10 @@ class @Gush
|
|
3
3
|
@workflows = {}
|
4
4
|
@machines = {}
|
5
5
|
|
6
|
-
initialize: ->
|
6
|
+
initialize: (jobs) ->
|
7
7
|
@registerSockets()
|
8
8
|
@displayCurrentWorkflows()
|
9
|
-
@displayJobsOverview()
|
9
|
+
@displayJobsOverview(jobs)
|
10
10
|
|
11
11
|
registerSockets: ->
|
12
12
|
@registerWorkersSocket()
|
@@ -18,11 +18,26 @@ class @Gush
|
|
18
18
|
($("table.workflows").data("workflows") || []).each (workflow) =>
|
19
19
|
@_addWorkflow(workflow)
|
20
20
|
|
21
|
-
|
21
|
+
filterJobs: (filter) ->
|
22
|
+
table = $("table.jobs tbody")
|
23
|
+
|
24
|
+
table.find("tr").hide()
|
25
|
+
if filter == "all"
|
26
|
+
table.find("tr").show()
|
27
|
+
else
|
28
|
+
table.find("tr.#{filter}").show()
|
29
|
+
|
30
|
+
refreshJobList: ->
|
31
|
+
filter = $('.jobs-filter dd.active a').data('filter')
|
32
|
+
@filterJobs(filter)
|
33
|
+
|
34
|
+
displayJobsOverview: (jobs) ->
|
22
35
|
if jobs?
|
36
|
+
$("table.jobs tbody").html("")
|
23
37
|
jobs.each (job) ->
|
24
38
|
j = new Job(job)
|
25
39
|
$("table.jobs tbody").append(j.render())
|
40
|
+
@refreshJobList()
|
26
41
|
|
27
42
|
registerWorkersSocket: ->
|
28
43
|
workersSocket = new WebSocket(@_socketUrl("subscribe/workers.status"))
|
@@ -156,6 +171,7 @@ class @Gush
|
|
156
171
|
|
157
172
|
_onStatus: (message) =>
|
158
173
|
message = JSON.parse(message.data)
|
174
|
+
console.log message
|
159
175
|
switch message.status
|
160
176
|
when "started"
|
161
177
|
@_onJobStart(message)
|
@@ -168,6 +184,7 @@ class @Gush
|
|
168
184
|
else
|
169
185
|
console.error("Unkown job status:", message.status, "data: ", message)
|
170
186
|
|
187
|
+
|
171
188
|
_onWorkflowStatusChange: (message) =>
|
172
189
|
message = JSON.parse(message.data)
|
173
190
|
workflow = @workflows[message.workflow_id]
|
@@ -185,11 +202,9 @@ class @Gush
|
|
185
202
|
|
186
203
|
_onJobStart: (message) =>
|
187
204
|
@_updateGraphStatus(message.workflow_id)
|
188
|
-
@_updateJobStatus(message.job, "Running")
|
189
205
|
|
190
206
|
_onJobSuccess: (message) =>
|
191
207
|
@_updateGraphStatus(message.workflow_id)
|
192
|
-
@_updateJobStatus(message.job, "Finished")
|
193
208
|
|
194
209
|
workflow = @workflows[message.workflow_id]
|
195
210
|
if workflow
|
@@ -200,7 +215,6 @@ class @Gush
|
|
200
215
|
|
201
216
|
_onJobFail: (message) =>
|
202
217
|
@_updateGraphStatus(message.workflow_id)
|
203
|
-
@_updateJobStatus(message.job, "Failed")
|
204
218
|
|
205
219
|
workflow = @workflows[message.workflow_id]
|
206
220
|
if workflow
|
@@ -221,16 +235,14 @@ class @Gush
|
|
221
235
|
console.log(response)
|
222
236
|
success: (response) =>
|
223
237
|
graph = new Graph("canvas-#{workflow_id}")
|
238
|
+
@displayJobsOverview(response.jobs)
|
224
239
|
response.jobs.each (job) ->
|
225
240
|
klasses = switch
|
226
241
|
when job.failed then "status-finished status-failed"
|
227
242
|
when job.finished then "status-finished"
|
228
|
-
when job.enqueued then "status-
|
243
|
+
when job.enqueued then "status-enqueued"
|
229
244
|
graph.markNode(job.name, klasses)
|
230
245
|
|
231
|
-
_updateJobStatus: (name, status) ->
|
232
|
-
$(".jobs tbody").find("td:contains('#{name}')").next("td").html(status).parent().removeClass().addClass(status.toLowerCase())
|
233
|
-
|
234
246
|
_socketUrl: (path) ->
|
235
247
|
"ws://#{window.location.host}/#{path}"
|
236
248
|
|
@@ -33,4 +33,11 @@ class @Job
|
|
33
33
|
@data.hasOwnProperty("finished")
|
34
34
|
|
35
35
|
render: ->
|
36
|
-
|
36
|
+
if @isValid()
|
37
|
+
Templates.job
|
38
|
+
name: @data.name
|
39
|
+
started_at: @data.started_at
|
40
|
+
finished_at: @data.finished_at
|
41
|
+
status: @status()
|
42
|
+
class: @status().toLowerCase()
|
43
|
+
|
data/lib/gush/control/version.rb
CHANGED
@@ -32,17 +32,15 @@
|
|
32
32
|
dl.sub-nav.jobs-filter
|
33
33
|
dt Filter:
|
34
34
|
dd.active
|
35
|
-
a All
|
35
|
+
a data-filter="all" All
|
36
36
|
dd
|
37
|
-
a Waiting
|
37
|
+
a data-filter="waiting" Waiting
|
38
38
|
dd
|
39
|
-
a Enqueued
|
39
|
+
a data-filter="enqueued" Enqueued
|
40
40
|
dd
|
41
|
-
a
|
41
|
+
a data-filter="failed" Failed
|
42
42
|
dd
|
43
|
-
a
|
44
|
-
dd
|
45
|
-
a Finished
|
43
|
+
a data-filter="finished" Finished
|
46
44
|
table.jobs
|
47
45
|
thead
|
48
46
|
th Name
|