mirror of
https://github.com/augustin64/projet-tipe
synced 2025-01-23 23:26:25 +01:00
Add test lock
This commit is contained in:
parent
b4e46d44b0
commit
f904482199
@ -107,7 +107,7 @@ def post_network():
|
|||||||
|
|
||||||
request.files["file"].save(training.delta)
|
request.files["file"].save(training.delta)
|
||||||
training.patch()
|
training.patch()
|
||||||
|
training.computed_images += clients[token].performance
|
||||||
# Préparation de la réponse
|
# Préparation de la réponse
|
||||||
data = {}
|
data = {}
|
||||||
data["status"] = "ok"
|
data["status"] = "ok"
|
||||||
@ -132,7 +132,7 @@ def post_network():
|
|||||||
data["nb_elem"] = 0
|
data["nb_elem"] = 0
|
||||||
data["start"] = 0
|
data["start"] = 0
|
||||||
data["instruction"] = "sleep"
|
data["instruction"] = "sleep"
|
||||||
data["sleep_time"] = 0.2
|
data["sleep_time"] = 0.02
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class Client:
|
|||||||
"""
|
"""
|
||||||
Donne un travail au client
|
Donne un travail au client
|
||||||
"""
|
"""
|
||||||
if training.nb_images == training.cur_image:
|
if training.nb_images <= training.computed_images:
|
||||||
if training.batchs == training.cur_batch:
|
if training.batchs == training.cur_batch:
|
||||||
raise NoMoreJobAvailableError
|
raise NoMoreJobAvailableError
|
||||||
raise TryLaterError
|
raise TryLaterError
|
||||||
@ -54,6 +54,8 @@ class Training:
|
|||||||
self.batchs = batchs
|
self.batchs = batchs
|
||||||
self.cur_batch = 1
|
self.cur_batch = 1
|
||||||
self.cur_image = 0
|
self.cur_image = 0
|
||||||
|
self.computed_images = 0
|
||||||
|
self.lock_test = False
|
||||||
self.dataset = dataset
|
self.dataset = dataset
|
||||||
self.test_set = test_set
|
self.test_set = test_set
|
||||||
self.cache = cache
|
self.cache = cache
|
||||||
@ -89,6 +91,10 @@ class Training:
|
|||||||
"""
|
"""
|
||||||
Teste les performances du réseau avant le batch suivant
|
Teste les performances du réseau avant le batch suivant
|
||||||
"""
|
"""
|
||||||
|
if self.lock_test:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.lock_test = True
|
||||||
if not os.path.isfile("out/main"):
|
if not os.path.isfile("out/main"):
|
||||||
subprocess.call(["./make.sh", "build", "main"])
|
subprocess.call(["./make.sh", "build", "main"])
|
||||||
|
|
||||||
@ -101,9 +107,13 @@ class Training:
|
|||||||
])
|
])
|
||||||
self.cur_batch += 1
|
self.cur_batch += 1
|
||||||
self.cur_image = 0
|
self.cur_image = 0
|
||||||
|
self.computed_images = 0
|
||||||
if self.cur_batch >= self.batchs:
|
if self.cur_batch >= self.batchs:
|
||||||
print("Done.")
|
print("Done.")
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
|
self.lock_test = False
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def patch(self):
|
def patch(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user