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
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
Léo-Paul Géneau
slapos.core
Commits
02bcc9a3
Commit
02bcc9a3
authored
Feb 28, 2019
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grid.promise: save and use promise periodicity in cache
parent
ababf1f6
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
72 deletions
+50
-72
slapos/grid/promise/__init__.py
slapos/grid/promise/__init__.py
+50
-65
slapos/grid/promise/generic.py
slapos/grid/promise/generic.py
+0
-7
No files found.
slapos/grid/promise/__init__.py
View file @
02bcc9a3
This diff is collapsed.
Click to expand it.
slapos/grid/promise/generic.py
View file @
02bcc9a3
...
@@ -46,7 +46,6 @@ PROMISE_RESULT_FOLDER_NAME = '.slapgrid/promise/result'
...
@@ -46,7 +46,6 @@ PROMISE_RESULT_FOLDER_NAME = '.slapgrid/promise/result'
PROMISE_LOG_FOLDER_NAME
=
'.slapgrid/promise/log'
PROMISE_LOG_FOLDER_NAME
=
'.slapgrid/promise/log'
PROMISE_PARAMETER_NAME
=
'extra_config_dict'
PROMISE_PARAMETER_NAME
=
'extra_config_dict'
PROMISE_PERIOD_FILE_NAME
=
'%s.periodicity'
LOGLINE_RE
=
r"(\
d{
4}-\
d{
2}-\
d{
2}\
s+
\d{2}:\
d{
2}:\
d{
2})\
s+
\-?\
s*(
\w{4,7})\
s+
\-?\
s+(
\d+\
-
\d{3})\
s+
\-?\
s*(.*)
"
LOGLINE_RE
=
r"(\
d{
4}-\
d{
2}-\
d{
2}\
s+
\d{2}:\
d{
2}:\
d{
2})\
s+
\-?\
s*(
\w{4,7})\
s+
\-?\
s+(
\d+\
-
\d{3})\
s+
\-?\
s*(.*)
"
matchLogStr = re.compile(LOGLINE_RE).match
matchLogStr = re.compile(LOGLINE_RE).match
...
@@ -159,10 +158,6 @@ class GenericPromise(with_metaclass(ABCMeta, object)):
...
@@ -159,10 +158,6 @@ class GenericPromise(with_metaclass(ABCMeta, object)):
self.__promise_path = self.__config.pop('path', None)
self.__promise_path = self.__config.pop('path', None)
self.__queue = self.__config.pop('queue', None)
self.__queue = self.__config.pop('queue', None)
self.__logger_buffer = None
self.__logger_buffer = None
self.__periodicity_file = os.path.join(
self.__partition_folder,
PROMISE_STATE_FOLDER_NAME,
PROMISE_PERIOD_FILE_NAME % self.__name)
self.setPeriodicity(self.__config.pop('periodicity', 2))
self.setPeriodicity(self.__config.pop('periodicity', 2))
self.__transaction_id = '%s-%s' % (int(time.time()), random.randint(100, 999))
self.__transaction_id = '%s-%s' % (int(time.time()), random.randint(100, 999))
...
@@ -236,8 +231,6 @@ class GenericPromise(with_metaclass(ABCMeta, object)):
...
@@ -236,8 +231,6 @@ class GenericPromise(with_metaclass(ABCMeta, object)):
if minute <= 0:
if minute <= 0:
raise ValueError("
Cannot
set
promise
periodicity
to
a
value
less
than
1
")
raise ValueError("
Cannot
set
promise
periodicity
to
a
value
less
than
1
")
self.__periodicity = minute
self.__periodicity = minute
with open(self.__periodicity_file, 'w') as f:
f.write('%s' % minute)
def getPeriodicity(self):
def getPeriodicity(self):
return self.__periodicity
return self.__periodicity
...
...
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