def run(self): """Renders the given job, encapsulating all processing errors and exceptions. This does not affect the job entry in the database in any way. It's the responsibility of the caller to do maintain the job status in the database. Returns one of the RESULT_ constants. """ LOG.info("Rendering job #%d '%s'..." % (self.job.id, self.job.maptitle)) try: if not self.job.administrative_city: bbox = BoundingBox( self.job.lat_upper_left, self.job.lon_upper_left, self.job.lat_bottom_right, self.job.lon_bottom_right, ) renderer = OCitySMap( config_file=OCITYSMAP_CFG_PATH, map_areas_prefix=self.prefix, boundingbox=bbox, language=self.job.map_language, ) else: renderer = OCitySMap( config_file=OCITYSMAP_CFG_PATH, map_areas_prefix=self.prefix, osmid=self.job.administrative_osmid, language=self.job.map_language, ) except KeyboardInterrupt: self.result = RESULT_KEYBOARD_INTERRUPT LOG.info("Rendering of job #%d interrupted!" % self.job.id) return self.result except Exception, e: self.result = RESULT_PREPARATION_EXCEPTION LOG.exception("Rendering of job #%d failed (exception occurred during" " data preparation)!" % self.job.id) return self.result
def run(self): """Renders the given job, encapsulating all processing errors and exceptions. This does not affect the job entry in the database in any way. It's the responsibility of the caller to do maintain the job status in the database. Returns one of the RESULT_ constants. """ LOG.info("Rendering job #%d '%s'..." % (self.job.id, self.job.maptitle)) try: if not self.job.administrative_city: bbox = BoundingBox(self.job.lat_upper_left, self.job.lon_upper_left, self.job.lat_bottom_right, self.job.lon_bottom_right) renderer = OCitySMap(config_file=OCITYSMAP_CFG_PATH, map_areas_prefix=self.prefix, boundingbox=bbox, language=self.job.map_language) else: renderer = OCitySMap(config_file=OCITYSMAP_CFG_PATH, map_areas_prefix=self.prefix, osmid=self.job.administrative_osmid, language=self.job.map_language) except KeyboardInterrupt: self.result = RESULT_KEYBOARD_INTERRUPT LOG.info("Rendering of job #%d interrupted!" % self.job.id) return self.result except Exception, e: self.result = RESULT_PREPARATION_EXCEPTION LOG.exception( "Rendering of job #%d failed (exception occurred during" " data preparation)!" % self.job.id) return self.result