Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OSUG
RESIF
resif_amqp_worker
Commits
7197dd72
Commit
7197dd72
authored
Jul 22, 2021
by
Jonathan Schaeffer
Browse files
Better subprocess management
parent
4995128b
Changes
1
Hide whitespace changes
Inline
Side-by-side
amqpWorker.py
View file @
7197dd72
...
...
@@ -145,9 +145,9 @@ def seedtree(content):
def
wfcatalog
(
content
):
# launch wfcatalog updates, 100 files for each run
for
chunk
in
grouper
(
content
.
splitlines
(),
50
):
logger
.
info
(
"launching WFCatalog
update
on : %s"
%
str
(
chunk
))
logger
.
info
(
"launching WFCatalog
collector
on : %s"
%
str
(
chunk
))
files
=
json
.
dumps
(
chunk
)
sp
=
subprocess
.
Pope
n
(
sp
=
subprocess
.
ru
n
(
[
"python3"
,
"./wfcatalog/collector/WFCatalogCollector.py"
,
...
...
@@ -156,12 +156,10 @@ def wfcatalog(content):
"--stdout"
,
"--list"
,
files
,
],
stdout
=
subprocess
.
PIPE
)
(
out
,
err
)
=
sp
.
communicate
()
if
out
:
logger
.
info
(
"WFCatalog standard output:
\n
%s"
,
out
.
decode
(
'utf-8'
))
if
err
:
logger
.
info
(
"WFCatalog standard error:
\n
%s"
,
err
.
decode
(
'utf-8'
))
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
logger
.
info
(
"WFCollector exit status: %s"
,
sp
.
returncode
)
logger
.
ingo
(
"WFCollector stdout:
\n
%s"
,
sp
.
stdout
.
decode
())
logger
.
info
(
"WFCatalog stderr:
\n
%s"
,
sp
.
stderr
.
decode
())
if
__name__
==
"__main__"
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment