Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.core
Commits
0218b908
Commit
0218b908
authored
Apr 05, 2012
by
Yingjie Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delay a randomized period of time when initialize.
parent
5533c318
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+11
-0
No files found.
slapos/grid/slapgrid.py
View file @
0218b908
...
...
@@ -57,6 +57,8 @@ import tempfile
from
time
import
strftime
import
StringIO
from
lxml
import
etree
from
time
import
sleep
from
random
import
random
MANDATORY_PARAMETER_LIST
=
[
...
...
@@ -114,6 +116,8 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple):
help
=
"Promise timeout in seconds."
)
parser
.
add_argument
(
"configuration_file"
,
nargs
=
1
,
type
=
argparse
.
FileType
(),
help
=
"SlapOS configuration file."
)
parser
.
add_argument
(
"--maximal_delay"
,
help
=
"The maximal delay value in seconds. "
\
"A negative value leads start immediately."
)
# Parses arguments
if
argument_tuple
==
():
...
...
@@ -215,6 +219,13 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple):
else
:
signature_certificate_list
=
None
maximal_delay
=
float
(
option_dict
.
get
(
"maximal_delay"
,
"300"
))
if
maximal_delay
>
0
:
duration
=
maximal_delay
*
random
()
logging
.
info
(
"Sleeping for %s seconds. To disable this feature, "
\
"check maximal_delay parameter in manual."
%
duration
)
time
.
sleep
(
duration
)
# Returning new Slapgrid instance and options
return
([
Slapgrid
(
software_root
=
option_dict
[
'software_root'
],
instance_root
=
option_dict
[
'instance_root'
],
...
...
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