mirror of
https://github.com/ThomasGsp/HyperProxmox.git
synced 2025-02-15 04:32:15 +00:00
Insert lock system for mod analyst
This commit is contained in:
parent
a1b0609332
commit
c335afc350
1 changed files with 9 additions and 0 deletions
|
@ -11,6 +11,7 @@ to allocate news instances.
|
||||||
from core.modules.mod_proxmox import *
|
from core.modules.mod_proxmox import *
|
||||||
from core.modules.mod_database import *
|
from core.modules.mod_database import *
|
||||||
from core.libs.hcrypt import *
|
from core.libs.hcrypt import *
|
||||||
|
from core.libs.locker import *
|
||||||
import time
|
import time
|
||||||
import operator
|
import operator
|
||||||
import random
|
import random
|
||||||
|
@ -53,6 +54,10 @@ class Analyse:
|
||||||
def run(self, instancetype="all"):
|
def run(self, instancetype="all"):
|
||||||
insert_time = time.time()
|
insert_time = time.time()
|
||||||
|
|
||||||
|
""" Create lock file """
|
||||||
|
locker = Locker()
|
||||||
|
locker.createlock(self.generalconf["hyperproxmox"]["walker_lock"], insert_time)
|
||||||
|
|
||||||
self.mongo.insert_datekey(insert_time, 'running')
|
self.mongo.insert_datekey(insert_time, 'running')
|
||||||
|
|
||||||
for cluster in self.clusters_conf:
|
for cluster in self.clusters_conf:
|
||||||
|
@ -142,6 +147,10 @@ class Analyse:
|
||||||
print(nodes_list)
|
print(nodes_list)
|
||||||
|
|
||||||
self.mongo.update_datekey(int(insert_time), "OK")
|
self.mongo.update_datekey(int(insert_time), "OK")
|
||||||
|
|
||||||
|
""" Unlock file """
|
||||||
|
locker.unlock(self.generalconf["hyperproxmox"]["walker_lock"])
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def set_attribution(self, count):
|
def set_attribution(self, count):
|
||||||
|
|
Loading…
Reference in a new issue