Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos.toolbox
Commits
f8b05999
Commit
f8b05999
authored
Aug 27, 2014
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runner: runXXXWithLock calls supervisor instead of basic Popen
parent
35afff13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
22 deletions
+14
-22
slapos/runner/utils.py
slapos/runner/utils.py
+14
-22
No files found.
slapos/runner/utils.py
View file @
f8b05999
...
@@ -9,11 +9,13 @@ import logging
...
@@ -9,11 +9,13 @@ import logging
import
md5
import
md5
import
multiprocessing
import
multiprocessing
import
os
import
os
import
sup_process
import
re
import
re
import
shutil
import
shutil
import
thread
import
thread
import
time
import
time
import
urllib
import
urllib
import
xmlrpclib
from
xml.dom
import
minidom
from
xml.dom
import
minidom
import
xml_marshaller
import
xml_marshaller
...
@@ -319,19 +321,14 @@ def runSoftwareWithLock(config, lock=True):
...
@@ -319,19 +321,14 @@ def runSoftwareWithLock(config, lock=True):
os
.
remove
(
config
[
'software_log'
])
os
.
remove
(
config
[
'software_log'
])
if
not
updateProxy
(
config
):
if
not
updateProxy
(
config
):
return
False
return
False
slapgrid
=
Popen
([
config
[
'slapos'
],
'node'
,
'software'
,
'--all'
,
try
:
'--cfg'
,
config
[
'slapos_cfg'
],
'--pidfile'
,
slapgrid_pid
,
sup_process
.
runProcess
(
config
,
"slapgrid-sr"
)
'--verbose'
,
'--logfile'
,
config
[
'software_log'
]],
if
lock
:
name
=
'slapgrid-sr'
,
stdout
=
None
)
sup_process
.
waitForProcessEnd
(
config
,
"slapgrid-sr"
)
if
lock
:
slapgrid
.
wait
()
date
=
datetime
.
datetime
.
now
().
strftime
(
"%Y-%m-%d %H:%M:%S"
)
slapgridResultToFile
(
config
,
"software"
,
slapgrid
.
returncode
,
date
)
#Saves the current compile software for re-use
#Saves the current compile software for re-use
config_SR_folder
(
config
)
config_SR_folder
(
config
)
return
(
True
if
slapgrid
.
returncode
==
0
else
False
)
return
True
else
:
except
xmlrpclib
.
Fault
:
thread
.
start_new_thread
(
waitProcess
,
(
config
,
slapgrid
,
"software"
))
return
False
return
False
...
@@ -422,17 +419,12 @@ def runInstanceWithLock(config, lock=True):
...
@@ -422,17 +419,12 @@ def runInstanceWithLock(config, lock=True):
os
.
remove
(
config
[
'instance_log'
])
os
.
remove
(
config
[
'instance_log'
])
if
not
(
updateProxy
(
config
)
and
requestInstance
(
config
)):
if
not
(
updateProxy
(
config
)
and
requestInstance
(
config
)):
return
False
return
False
slapgrid
=
Popen
([
config
[
'slapos'
],
'node'
,
'instance'
,
'--all'
,
try
:
'--cfg'
,
config
[
'slapos_cfg'
],
'--pidfile'
,
slapgrid_pid
,
sup_process
.
runProcess
(
config
,
"slapgrid-cp"
)
'--verbose'
,
'--logfile'
,
config
[
'instance_log'
]],
if
lock
:
name
=
'slapgrid-cp'
,
stdout
=
None
)
sup_process
.
waitForProcessEnd
(
config
,
"slapgrid-cp"
)
if
lock
:
return
True
slapgrid
.
wait
()
except
xmlrpclib
.
Fault
:
date
=
datetime
.
datetime
.
now
().
strftime
(
"%Y-%m-%d %H:%M:%S"
)
slapgridResultToFile
(
config
,
"instance"
,
slapgrid
.
returncode
,
date
)
return
(
True
if
slapgrid
.
returncode
==
0
else
False
)
else
:
thread
.
start_new_thread
(
waitProcess
,
(
config
,
slapgrid
,
"instance"
))
return
False
return
False
...
...
Write
Preview
Markdown
is supported
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