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
Iliya Manolov
slapos.toolbox
Commits
5f575b85
Commit
5f575b85
authored
Jun 28, 2013
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
equeue: will remove socket on start
parent
e025bfd0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
slapos/equeue/__init__.py
slapos/equeue/__init__.py
+10
-5
No files found.
slapos/equeue/__init__.py
View file @
5f575b85
...
...
@@ -119,6 +119,14 @@ class EqueueServer(SocketServer.ThreadingUnixStreamServer):
else
:
self
.
logger
.
info
(
"%s already runned."
,
command
)
# Well the following function is made for schrodinger's files,
# It will work if the file exists or not
def
remove_existing_file
(
path
):
try
:
os
.
remove
(
path
)
except
OSError
,
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
def
main
():
parser
=
argparse
.
ArgumentParser
(
...
...
@@ -144,16 +152,13 @@ def main():
signal
.
signal
(
signal
.
SIGHUP
,
lambda
*
args
:
sys
.
exit
(
-
1
))
signal
.
signal
(
signal
.
SIGTERM
,
lambda
*
args
:
sys
.
exit
())
remove_existing_file
(
socketpath
)
try
:
server
=
EqueueServer
(
socketpath
,
**
{
'equeue_options'
:
args
})
server
.
logger
.
info
(
"Starting server on %r"
,
socketpath
)
server
.
serve_forever
()
finally
:
try
:
os
.
remove
(
socketpath
)
except
OSError
,
e
:
if
e
.
errno
!=
errno
.
ENOENT
:
raise
remove_existing_file
(
socketpath
)
if
__name__
==
'__main__'
:
main
()
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