def move_to_template(self, avd): logger.info("moving avd %s to template storage" % avd) template_path_base = os.path.join(settings.avd_template_dir, avd) avd_path_base = self.get_avd_base(avd) flags.make_dir(settings.avd_template_dir) logger.debug("copy from %s -> %s" % (avd_path_base, template_path_base)) shutil.copytree(avd_path_base + ".avd", template_path_base + ".avd") shutil.copy(avd_path_base + ".ini", template_path_base + ".ini") logger.debug("remove %s" % avd_path_base) shutil.rmtree(avd_path_base + ".avd") os.remove(avd_path_base + ".ini") logger.info("moved")
show(country) save_flag(image, country.lower(), type='png') return country def download_many(country_list): loop = asyncio.get_event_loop( ) # Main Thread만 event loop를 default로 가지고 있다. to_do = [download_one(loop, country) for country in sorted(country_list)] wait_coro = asyncio.wait(to_do) res, _ = loop.run_until_complete(wait_coro) loop.close() return len(res) def interrupt_printer(): print("sleep(1)") time.sleep(1) print() print("<<Interrupt Main Thread from worker_thread>>") if __name__ == '__main__': # worker_thread = threading.Thread(target=main_method, args=(download_many,)) worker_thread = threading.Thread(target=interrupt_printer) worker_thread.start() make_dir() main_method(download_many) worker_thread.join()
def lock_local_avds(self, avd_name): logger.debug("grab local avd lock: %s" % avd_name) flags.make_dir(settings.local_avd_lock_dir) return flags.grab_lock(os.path.join(settings.local_avd_lock_dir, "%s.lock" % avd_name))
def lock_avds(self, avd_name): logger.debug("grab avd lock: %s" % avd_name) flags.make_dir(os.path.expanduser('~/.android')) return flags.grab_lock(os.path.expanduser("~/.android/%s.lock") % avd_name)
def lock_local_avds(self, avd_name): logger.debug("grab local avd lock: %s" % avd_name) flags.make_dir(settings.local_avd_lock_dir) return flags.grab_lock( os.path.join(settings.local_avd_lock_dir, "%s.lock" % avd_name))
def lock_avds(self, avd_name): logger.debug("grab avd lock: %s" % avd_name) flags.make_dir(os.path.expanduser('~/.android')) return flags.grab_lock( os.path.expanduser("~/.android/%s.lock") % avd_name)