postjob 0.3.4 → 0.3.5
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/ps.rb +7 -3
- data/lib/postjob/migrations/008a_childjobs.sql +1 -1
- data/lib/postjob/migrations.rb +1 -1
- data/lib/postjob/queue.rb +7 -7
- data/lib/postjob/runner.rb +3 -2
- 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: 19ac068f3a63b97556c7ce6aefe07e10ead759f1
|
4
|
+
data.tar.gz: 003e5725fa65129288ddc34eac9625a751cc252e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3874859c70f5c0182189acbb7cbf6e16130497b6ea5783658f280f2355a6e205a020724100c293f0fe427fa146251e1fc57756af6ad892ed08b24b68c9745745
|
7
|
+
data.tar.gz: 9f040743503861a3aaa2571a56d4081c4c915649b558990f201218e9207c2dc8e3576332ed7793c6a13835db66bbdaeab2687d02a8d5ff14adb0f8c284e9a945
|
data/lib/postjob/cli/ps.rb
CHANGED
@@ -87,10 +87,14 @@ module Postjob::CLI
|
|
87
87
|
print_sql limit: limit, query: query
|
88
88
|
end
|
89
89
|
|
90
|
-
def ps_top(*ids, limit: "100", tags: nil)
|
90
|
+
def ps_top(*ids, limit: "100", tags: nil, full: false)
|
91
91
|
loop do
|
92
92
|
system "clear"
|
93
|
-
|
93
|
+
if full
|
94
|
+
ps_full(*ids, limit: limit, tags: tags)
|
95
|
+
else
|
96
|
+
ps(*ids, limit: limit, tags: tags)
|
97
|
+
end
|
94
98
|
sleep 1
|
95
99
|
end
|
96
100
|
rescue Interrupt
|
@@ -138,7 +142,7 @@ module Postjob::CLI
|
|
138
142
|
end
|
139
143
|
|
140
144
|
def print_sql(limit:, query:)
|
141
|
-
records = Simple::SQL.
|
145
|
+
records = Simple::SQL.all("#{query} LIMIT $1+1", limit, into: Hash)
|
142
146
|
|
143
147
|
tp records[0, limit]
|
144
148
|
if records.length > limit
|
@@ -8,7 +8,7 @@ BEGIN
|
|
8
8
|
END;
|
9
9
|
$$ LANGUAGE plpgsql;
|
10
10
|
|
11
|
-
CREATE OR REPLACE FUNCTION {SCHEMA_NAME}.
|
11
|
+
CREATE OR REPLACE FUNCTION {SCHEMA_NAME}.unresolved_childjobs(v_parent_id BIGINT)
|
12
12
|
RETURNS SETOF {SCHEMA_NAME}.postjobs AS $$
|
13
13
|
BEGIN
|
14
14
|
RETURN QUERY
|
data/lib/postjob/migrations.rb
CHANGED
data/lib/postjob/queue.rb
CHANGED
@@ -48,7 +48,7 @@ module Postjob::Queue
|
|
48
48
|
# a) a limitation in Simple::SQL which would not be able to unpack a
|
49
49
|
# "SELECT function()" usefully when the return value is a record;
|
50
50
|
# b) and/or my inability to write better SQL functions;
|
51
|
-
SQL.
|
51
|
+
SQL.ask "SELECT * FROM #{SCHEMA_NAME}.enqueue($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
52
52
|
options[:queue],
|
53
53
|
workflow,
|
54
54
|
workflow_method,
|
@@ -79,12 +79,12 @@ module Postjob::Queue
|
|
79
79
|
|
80
80
|
def childjobs(parent)
|
81
81
|
expect! parent => Job
|
82
|
-
SQL.
|
82
|
+
SQL.all "SELECT * FROM #{SCHEMA_NAME}.childjobs($1)", parent.id, into: Job
|
83
83
|
end
|
84
84
|
|
85
|
-
def
|
85
|
+
def unresolved_childjobs(parent)
|
86
86
|
expect! parent => Job
|
87
|
-
SQL.
|
87
|
+
SQL.ask "SELECT COUNT(*) FROM #{SCHEMA_NAME}.unresolved_childjobs($1)", parent.id
|
88
88
|
end
|
89
89
|
|
90
90
|
def find_or_create_childjob(parent, workflow, args, timeout:, max_attempts:, queue: nil)
|
@@ -97,7 +97,7 @@ module Postjob::Queue
|
|
97
97
|
# a) a limitation in Simple::SQL which would not be able to unpack a
|
98
98
|
# "SELECT function()" usefully when the return value is a record;
|
99
99
|
# b) and/or my inability to write better SQL functions;
|
100
|
-
return SQL.
|
100
|
+
return SQL.ask "SELECT * FROM #{SCHEMA_NAME}.find_or_create_childjob($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
101
101
|
queue,
|
102
102
|
workflow,
|
103
103
|
workflow_method,
|
@@ -138,7 +138,7 @@ module Postjob::Queue
|
|
138
138
|
public
|
139
139
|
|
140
140
|
def checkout(workflows_with_versions)
|
141
|
-
SQL.
|
141
|
+
SQL.ask "SELECT * FROM #{SCHEMA_NAME}.checkout($1, $2)",
|
142
142
|
workflows_with_versions, Postjob.fast_mode, into: Job
|
143
143
|
end
|
144
144
|
|
@@ -147,6 +147,6 @@ module Postjob::Queue
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def find_job_by_token(token)
|
150
|
-
SQL.
|
150
|
+
SQL.ask "SELECT * FROM #{SCHEMA_NAME}.postjobs_by_token($1)", token, into: Job
|
151
151
|
end
|
152
152
|
end
|
data/lib/postjob/runner.rb
CHANGED
@@ -55,8 +55,9 @@ module Postjob::Runner
|
|
55
55
|
def await(job, *args, timeout: nil, max_attempts: nil)
|
56
56
|
case job
|
57
57
|
when :all
|
58
|
-
|
59
|
-
|
58
|
+
unresolved_childjobs = Postjob::Queue.unresolved_childjobs(current_job)
|
59
|
+
if unresolved_childjobs > 0
|
60
|
+
Postjob.logger.debug "await :all: Found #{unresolved_childjobs} unresolved childjobs"
|
60
61
|
throw :pending, :pending
|
61
62
|
else
|
62
63
|
childjobs = Postjob::Queue.childjobs(current_job)
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- radiospiel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|