postjob 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/postjob/cli/job.rb +12 -0
- data/lib/postjob/cli/ps.rb +9 -5
- data/lib/postjob.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04c8dbb68c7f61be34b8bfe642fdd6ce04933e08
|
4
|
+
data.tar.gz: 355aca75cf91e2107d850163802ab87aabf94126
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50c02c184aab359a4c67d5b4b853560aac3a54636ed603cbfd7c161b61057c807d9ea0a752bce79a4c57c77f0f4841c4d7b5cbe33535bfafb42d2c0b8a50e46b
|
7
|
+
data.tar.gz: 56e861011da77177e1e8b147ff2447a26f292b8bdeceeec117dfd2b979cd4ca0449e493c2f00f4cce3cecceb99b2677f2fce177aaca241c61997082d7a6764d5
|
data/lib/postjob/cli/job.rb
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
module Postjob::CLI
|
2
|
+
# Resolve a job by token
|
3
|
+
def job_resolve(token, result)
|
4
|
+
connect_to_database!
|
5
|
+
Postjob.resolve(token: token, result: result)
|
6
|
+
end
|
7
|
+
|
8
|
+
# # Fail a job by token
|
9
|
+
# def job_resolve(token, result)
|
10
|
+
# connect_to_database!
|
11
|
+
# Postjob.resolve(token: token, result: result)
|
12
|
+
# end
|
13
|
+
|
2
14
|
# Enqueues a workflow
|
3
15
|
#
|
4
16
|
# Adds a workflow to the job table, with name <workflow> and the given
|
data/lib/postjob/cli/ps.rb
CHANGED
@@ -7,7 +7,7 @@ module Postjob::CLI
|
|
7
7
|
def ps_query(tags:, limit:)
|
8
8
|
sql = <<-SQL
|
9
9
|
SELECT
|
10
|
-
id,
|
10
|
+
postjobs.id,
|
11
11
|
full_id,
|
12
12
|
workflow
|
13
13
|
|| (CASE WHEN workflow_version != '' THEN '@' ELSE '' END)
|
@@ -20,7 +20,7 @@ module Postjob::CLI
|
|
20
20
|
COALESCE((results->0)::varchar, error_message) AS result,
|
21
21
|
next_run_at,
|
22
22
|
next_run_at - (now() at time zone 'utc') AS next_run_in,
|
23
|
-
to_char(EXTRACT(EPOCH FROM (now() at time zone 'utc') - created_at), '999999999.99') AS age,
|
23
|
+
to_char(EXTRACT(EPOCH FROM (now() at time zone 'utc') - postjobs.created_at), '999999999.99') AS age,
|
24
24
|
CASE WHEN processing_started_at IS NOT NULL THEN
|
25
25
|
format(
|
26
26
|
'%s/%s',
|
@@ -30,7 +30,7 @@ module Postjob::CLI
|
|
30
30
|
END AS processing,
|
31
31
|
COALESCE(processing_client, '') || COALESCE('/' || processing_client_identifier, '') AS worker,
|
32
32
|
tags
|
33
|
-
FROM postjob.postjobs
|
33
|
+
FROM postjob.postjobs AS postjobs
|
34
34
|
SQL
|
35
35
|
|
36
36
|
scope = Simple::SQL::Scope.new(sql)
|
@@ -105,8 +105,12 @@ module Postjob::CLI
|
|
105
105
|
def ps_show(id, *ids)
|
106
106
|
connect_to_database!
|
107
107
|
|
108
|
-
scope = Simple::SQL::Scope.new
|
109
|
-
|
108
|
+
scope = Simple::SQL::Scope.new <<~SQL
|
109
|
+
SELECT postjobs.*, tokens.token
|
110
|
+
FROM postjob.postjobs AS postjobs
|
111
|
+
LEFT JOIN postjob.tokens AS tokens ON tokens.postjob_id=postjobs.id
|
112
|
+
SQL
|
113
|
+
scope = scope.where("postjobs.id = ANY(?)", parse_ids(id, *ids))
|
110
114
|
|
111
115
|
Simple::SQL.all(scope, into: Postjob::Job) do |job|
|
112
116
|
pp job
|
data/lib/postjob.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postjob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- radiospiel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|