def __del__(self): if self._c1 is not None: LOGGER.debug("Destructing : "+self._app_name) ram_bef = int(memory_used_by_process_current(os.getpid())) del self._c1 ram_after = int(memory_used_by_process_current(os.getpid())) LOGGER.debug("RAM : " + str(ram_bef) +" : "+ str(ram_after) + " : "+str(ram_bef-ram_after) + " MB")
def _post(self): LOGGER.debug("Running : " + self._app_name) self._c1.post(self._write_output) LOGGER.debug("Finished : " + self._app_name + " ,RAM current : " + str(int(memory_used_by_process_current(os.getpid()))) + " MB" + " ,RAM max : " + str(int(memory_used_by_process2(os.getpid()))) + " MB")
def _run(self): start_time = time.time() LOGGER.debug("Running : " + self._app_name) self._c1.run(self._write_output) LOGGER.debug("Finished : " + self._app_name + " ,Time: "+time.strftime("%M min %S seconds", time.gmtime(time.time()-start_time)) + " ,RAM current : " + str(int(memory_used_by_process_current(os.getpid()))) + " MB" + " ,RAM max : "+ str(int(memory_used_by_process2(os.getpid())))+" MB")
def __init__(self, otb_app, parameters, write_output=True): self._c1 = MajaOtbCots() self._app_name = otb_app LOGGER.debug("Initializing : " + self._app_name) if "ram" not in list(parameters.keys()): curr_ram = int(memory_used_by_process_current(os.getpid())) avail_ram = OtbAppHandler.ram_to_use - curr_ram if avail_ram < OtbAppHandler.ram_to_use/OtbAppHandler.ram_limit_factor: parameters["ram"] = str(OtbAppHandler.ram_to_use / OtbAppHandler.ram_limit_factor) else: parameters["ram"] = str(avail_ram) LOGGER.debug(parameters) self._write_output = not is_croco_off() and (write_output or is_croco_on()) self._c1.pre(otb_app, parameters) if not get_test_mode(): self._run() self._post()