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
Lisa Casino
slapos.toolbox
Commits
7fb2f2be
Commit
7fb2f2be
authored
Nov 21, 2011
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose equeue as a console script.
parent
a0663640
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
5 deletions
+26
-5
setup.py
setup.py
+1
-0
slapos/equeue/__init__.py
slapos/equeue/__init__.py
+25
-5
No files found.
setup.py
View file @
7fb2f2be
...
@@ -55,6 +55,7 @@ setup(name=name,
...
@@ -55,6 +55,7 @@ setup(name=name,
'slaprunner = slapos.runner:run'
,
'slaprunner = slapos.runner:run'
,
'killpidfromfile = slapos.systool:killpidfromfile'
,
'killpidfromfile = slapos.systool:killpidfromfile'
,
'lampconfigure = slapos.lamp:run [lampconfigure]'
,
'lampconfigure = slapos.lamp:run [lampconfigure]'
,
'equeue = slapos.equeue:main'
,
]
]
},
},
)
)
slapos/equeue/__init__.py
View file @
7fb2f2be
...
@@ -35,6 +35,7 @@ import logging
...
@@ -35,6 +35,7 @@ import logging
import
logging.handlers
import
logging.handlers
import
signal
import
signal
import
subprocess
import
subprocess
import
argparse
cleanup_data
=
{}
cleanup_data
=
{}
...
@@ -110,15 +111,31 @@ class TaskRunner(object):
...
@@ -110,15 +111,31 @@ class TaskRunner(object):
raise
KeyError
(
"No task is running."
)
raise
KeyError
(
"No task is running."
)
return
self
.
_task
.
stdout
.
fileno
()
return
self
.
_task
.
stdout
.
fileno
()
def
main
(
args
):
def
main
():
global
cleanup_data
global
cleanup_data
socketpath
=
args
[
'socket'
]
parser
=
argparse
.
ArgumentParser
(
level
=
logging
.
_levelNames
.
get
(
str
(
args
[
'loglevel'
]),
logging
.
INFO
)
description
=
"Run a single threaded execution queue."
)
parser
.
add_argument
(
'--database'
,
nargs
=
1
,
required
=
True
,
help
=
"Path to the database where the last "
"calls are stored"
)
parser
.
add_argument
(
'--loglevel'
,
nargs
=
1
,
default
=
'INFO'
,
choices
=
[
i
for
i
in
logging
.
_levelNames
if
isinstance
(
i
,
str
)],
required
=
False
)
parser
.
add_argument
(
'-l'
,
'--logfile'
,
nargs
=
1
,
required
=
True
,
help
=
"Path to the log file."
)
parser
.
add_argument
(
'socket'
,
help
=
"Path to the unix socket"
)
args
=
parser
.
parse_args
()
socketpath
=
args
.
socket
level
=
logging
.
_levelNames
.
get
(
args
.
loglevel
[
0
],
logging
.
INFO
)
logger
=
logging
.
getLogger
(
"EQueue"
)
logger
=
logging
.
getLogger
(
"EQueue"
)
# Natively support logrotate
# Natively support logrotate
handler
=
logging
.
handlers
.
WatchedFileHandler
(
args
[
'logfile'
],
mode
=
'a'
)
handler
=
logging
.
handlers
.
WatchedFileHandler
(
args
.
logfile
[
0
],
mode
=
'a'
)
logger
.
setLevel
(
level
)
logger
.
setLevel
(
level
)
formatter
=
logging
.
Formatter
(
"%(asctime)s - %(levelname)s - %(message)s"
)
formatter
=
logging
.
Formatter
(
"%(asctime)s - %(levelname)s - %(message)s"
)
handler
.
setFormatter
(
formatter
)
handler
.
setFormatter
(
formatter
)
...
@@ -132,7 +149,7 @@ def main(args):
...
@@ -132,7 +149,7 @@ def main(args):
logger
.
debug
(
"Listen on socket"
)
logger
.
debug
(
"Listen on socket"
)
unixsocketfd
=
unixsocket
.
fileno
()
unixsocketfd
=
unixsocket
.
fileno
()
db
=
gdbm
.
open
(
args
[
'dbfile'
],
'cs'
,
0700
)
db
=
gdbm
.
open
(
args
.
database
[
0
],
'cs'
,
0700
)
logger
.
debug
(
"Open timestamp database"
)
logger
.
debug
(
"Open timestamp database"
)
...
@@ -212,3 +229,6 @@ def main(args):
...
@@ -212,3 +229,6 @@ def main(args):
finally
:
finally
:
cleanup
()
cleanup
()
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