import pickle, sys, time from pathlib import Path def main(): pkl = Path(sys.argv[1]); marker = Path(sys.argv[2]) if marker.exists(): try: marker.unlink() except: pass try: pool = pickle.load(open(pkl, "rb")) print("pool", pool) time.sleep(2.0) try: pool.terminate() pool.join() except Exception as e: print("cleanup", e) except Exception as e: print("exc", type(e).__name__, e) time.sleep(1.0) print("FIRED", marker.exists(), marker.stat().st_size if marker.exists() else None) if __name__ == "__main__": main()