Update update_secteur.py
restructuration
This commit is contained in:
parent
63e9766588
commit
5ea3089fd4
|
@ -13,7 +13,45 @@ import time
|
|||
# Functions
|
||||
#
|
||||
|
||||
def phase_1():
|
||||
|
||||
print("maj données phase 1 + maj du filaire de voirie routable")
|
||||
|
||||
try:
|
||||
subprocess.call(["./phase_1.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||
subprocess.call(["./create_osm_roads.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||
subprocess.call(["./update_osm_roads_pgr.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))
|
||||
|
||||
|
||||
|
||||
def routage():
|
||||
|
||||
print("maj du routage")
|
||||
|
||||
try:
|
||||
subprocess.call(["./phase_2_get_data.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||
subprocess.call(["./phase_2_routing_prepare.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||
subprocess.call(["./phase_2_routing_compute.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
|
||||
|
@ -73,41 +111,12 @@ print("")
|
|||
|
||||
|
||||
if typemaj == "tout":
|
||||
print("maj données phase 1 + maj du filaire de voirie routable")
|
||||
|
||||
try:
|
||||
subprocess.call(["./phase_1.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||
subprocess.call(["./create_osm_roads.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||
subprocess.call(["./update_osm_roads_pgr.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))
|
||||
phase_1()
|
||||
routage()
|
||||
|
||||
|
||||
if typemaj == "routage":
|
||||
print("maj du routage")
|
||||
|
||||
try:
|
||||
subprocess.call(["./phase_2_get_data.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||
subprocess.call(["./phase_2_routing_prepare.sh "+millesime+" "+secteur],shell=True,stderr=subprocess.STDOUT)
|
||||
subprocess.call(["./phase_2_routing_compute.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("")
|
||||
routage()
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue