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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Boxiang Sun
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
import
md5
import
multiprocessing
import
os
import
sup_process
import
re
import
shutil
import
thread
import
time
import
urllib
import
xmlrpclib
from
xml.dom
import
minidom
import
xml_marshaller
...
...
@@ -319,19 +321,14 @@ def runSoftwareWithLock(config, lock=True):
os
.
remove
(
config
[
'software_log'
])
if
not
updateProxy
(
config
):
return
False
slapgrid
=
Popen
([
config
[
'slapos'
],
'node'
,
'software'
,
'--all'
,
'--cfg'
,
config
[
'slapos_cfg'
],
'--pidfile'
,
slapgrid_pid
,
'--verbose'
,
'--logfile'
,
config
[
'software_log'
]],
name
=
'slapgrid-sr'
,
stdout
=
None
)
if
lock
:
slapgrid
.
wait
()
date
=
datetime
.
datetime
.
now
().
strftime
(
"%Y-%m-%d %H:%M:%S"
)
slapgridResultToFile
(
config
,
"software"
,
slapgrid
.
returncode
,
date
)
try
:
sup_process
.
runProcess
(
config
,
"slapgrid-sr"
)
if
lock
:
sup_process
.
waitForProcessEnd
(
config
,
"slapgrid-sr"
)
#Saves the current compile software for re-use
config_SR_folder
(
config
)
return
(
True
if
slapgrid
.
returncode
==
0
else
False
)
else
:
thread
.
start_new_thread
(
waitProcess
,
(
config
,
slapgrid
,
"software"
))
return
True
except
xmlrpclib
.
Fault
:
return
False
...
...
@@ -422,17 +419,12 @@ def runInstanceWithLock(config, lock=True):
os
.
remove
(
config
[
'instance_log'
])
if
not
(
updateProxy
(
config
)
and
requestInstance
(
config
)):
return
False
slapgrid
=
Popen
([
config
[
'slapos'
],
'node'
,
'instance'
,
'--all'
,
'--cfg'
,
config
[
'slapos_cfg'
],
'--pidfile'
,
slapgrid_pid
,
'--verbose'
,
'--logfile'
,
config
[
'instance_log'
]],
name
=
'slapgrid-cp'
,
stdout
=
None
)
if
lock
:
slapgrid
.
wait
()
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"
))
try
:
sup_process
.
runProcess
(
config
,
"slapgrid-cp"
)
if
lock
:
sup_process
.
waitForProcessEnd
(
config
,
"slapgrid-cp"
)
return
True
except
xmlrpclib
.
Fault
:
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