Update update_secteur.py
rajout phase 3 (plus besoin pour cette édition)
This commit is contained in:
parent
585c7c94b0
commit
47b58c6ca5
|
@ -10,7 +10,7 @@ import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
#
|
#
|
||||||
# Functions
|
# ===============================================================================================
|
||||||
#
|
#
|
||||||
|
|
||||||
def phase_1():
|
def phase_1():
|
||||||
|
@ -31,7 +31,9 @@ def phase_1():
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
raise RuntimeError("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
|
raise RuntimeError("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
|
||||||
|
|
||||||
|
#
|
||||||
|
# ===============================================================================================
|
||||||
|
#
|
||||||
|
|
||||||
def phase_2():
|
def phase_2():
|
||||||
|
|
||||||
|
@ -54,6 +56,30 @@ def phase_2():
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
|
#
|
||||||
|
# ===============================================================================================
|
||||||
|
#
|
||||||
|
|
||||||
|
def phase_3():
|
||||||
|
|
||||||
|
print("maj données phase 3 + calcul des PK autos")
|
||||||
|
|
||||||
|
try:
|
||||||
|
subprocess.call(["python phase_3_prepare.py "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||||
|
subprocess.call(["python phase_3_compute.py "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||||
|
subprocess.call(["./phase_3_export.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
print("")
|
||||||
|
stopTime = time.perf_counter()
|
||||||
|
hours, rem = divmod(stopTime - startTime, 3600)
|
||||||
|
minutes, seconds = divmod(rem, 60)
|
||||||
|
print("Exécuté en {:0>2}:{:0>2}:{:05.2f}".format(int(hours),int(minutes),seconds))
|
||||||
|
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
raise RuntimeError("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
|
||||||
|
|
||||||
|
print("")
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start processing
|
# Start processing
|
||||||
#
|
#
|
||||||
|
@ -85,9 +111,14 @@ try:
|
||||||
|
|
||||||
# ok : on passe au type de mise à jour demandé
|
# ok : on passe au type de mise à jour demandé
|
||||||
if len(list_of_args[3]) > 3:
|
if len(list_of_args[3]) > 3:
|
||||||
if list_of_args[3] == "tout": typemaj = "tout"
|
if list_of_args[3] == "tout":
|
||||||
elif list_of_args[3] == "phase_1": typemaj = "phase_1"
|
typemaj = "tout"
|
||||||
elif list_of_args[3] == "phase_2": typemaj = "phase_2"
|
elif list_of_args[3] == "phase_1":
|
||||||
|
typemaj = "phase_1"
|
||||||
|
elif list_of_args[3] == "phase_2":
|
||||||
|
typemaj = "phase_2"
|
||||||
|
elif list_of_args[3] == "phase_3":
|
||||||
|
typemaj = "phase_3"
|
||||||
else:
|
else:
|
||||||
print("Mauvais type de traitement en argument")
|
print("Mauvais type de traitement en argument")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -115,6 +146,7 @@ print("")
|
||||||
if typemaj == "tout":
|
if typemaj == "tout":
|
||||||
phase_1()
|
phase_1()
|
||||||
phase_2()
|
phase_2()
|
||||||
|
phase_3()
|
||||||
|
|
||||||
if typemaj == "phase_1":
|
if typemaj == "phase_1":
|
||||||
phase_1()
|
phase_1()
|
||||||
|
@ -122,6 +154,9 @@ if typemaj == "phase_1":
|
||||||
if typemaj == "phase_2":
|
if typemaj == "phase_2":
|
||||||
phase_2()
|
phase_2()
|
||||||
|
|
||||||
|
if typemaj == "phase_3":
|
||||||
|
phase_3()
|
||||||
|
|
||||||
|
|
||||||
# pour connaître le temps d'exécution
|
# pour connaître le temps d'exécution
|
||||||
print("")
|
print("")
|
||||||
|
|
Loading…
Reference in a new issue