Пример #1
0
 def execute(self):
     timer = time.time()
     OsmChangeTileGenCommand.execute(self)
     if self.post_process_tiles:
         self.post_process_tiles()
     timer = time.time() - timer
     print pretty_timer("   Tile generation time:", timer)
Пример #2
0
 def downloadUpdate(self):
     # Optimize openstreetmap.fr updates for periods longer than 30 hours
     period = (datetime.utcnow() -
               self.timestamp(self.base)).total_seconds()
     if self.status() == "base" and period > 30 * 3600:
         period -= period % 60
         App.log("=== {} ===".format(
             pretty_timer("Optimizing an update period of", period)))
         saved_base = self.base
         self.base = self.base + ".temp.pbf"
         self.silent_remove(self.base)
         exit_code = self.downloadBase()
         self.silent_remove(self.base)
         self.silent_remove(self.changes)
         if exit_code:
             self.silent_remove(self.updated)
             return exit_code
         self.base = saved_base
         exit_code = (App.run_program(
             "osmconvert.exe", 7200,
             [self.updated, "-o=" + self.updated + ".o5m"] +
             self.osmconvert_params)
                      or App.run_program("osmconvert.exe", 7200, [
                          "--diff", self.base, self.updated + ".o5m",
                          "-o=" + self.changes
                      ] + self.osmconvert_params))
         self.silent_remove(self.updated + ".o5m")
         if exit_code:
             self.silent_remove(self.changes)
             self.silent_remove(self.updated)
         return exit_code
     else:
         return osmChangeSource.downloadUpdate(self)
Пример #3
0
 def osmChangeRead(self, *args):
     timer = time.time()
     OsmChangeTileGenCommand.osmChangeRead(self, *args)
     timer = time.time() - timer
     print pretty_timer("   Osm Change analysis time:", timer)
Пример #4
0
 def execute(self):
     timer = time.time()
     OsmChangeTileGenCommand.execute(self)
     timer = time.time() - timer
     print pretty_timer("   Tile generation time:", timer)
Пример #5
0
def mark_done(phase):
    open(done_file(phase), 'a').close()
    App.log(phase + ' phase is done.')
    print pretty_timer("Current duration:",
                       (datetime.now() - start_time).total_seconds())
Пример #6
0
                os.path.join("Rules", "empty.mrules"))

if osm_source.status() in ("non-incremental", "incremental"):
    # Continue an incomplete run
    App.log('=== Continuing execution of the previous tile generation ===')
    App.log('Remaining phases: ' + ', '.join(remainingPhases))
    App.run_command("pause 15000")
else:
    exit_code = osm_source.downloadMap()
    if exit_code == 21:
        remainingPhases = []
    elif exit_code == 0:
        pass
    else:
        raise RuntimeError
    print pretty_timer("Current duration:",
                       (datetime.now() - start_time).total_seconds())

# Incremental tile generation?
if os.path.exists(osm_source.changes):
    if "timestamp max" not in osm_source.statistics(osm_source.changes):
        App.log("=== No map changes ===")
        remainingPhases = []
    else:
        # Osm Change analysis
        base_time = osm_source.timestamp(osm_source.base)
        updated_time = osm_source.timestamp(osm_source.updated)
        change_span = pretty_timer(
            "from {}Z to {}Z -".format(base_time.isoformat(),
                                       updated_time.isoformat()),
            (updated_time - base_time).total_seconds())
        App.log("=== Analyzing map changes {} ===".format(change_span))
Пример #7
0
def print_duration():
    print pretty_timer("Current duration:",
                       (datetime.utcnow() - start_time).total_seconds())