def run(self): self.np_tcp = scdc.nodeport_open("tcp:max_connections:", 2) self.np_stream = scdc.nodeport_open("stream:cmd_handler", cmd_handler, None) signal.signal(signal.SIGABRT, sighandler) signal.signal(signal.SIGTERM, sighandler) signal.signal(signal.SIGINT, sighandler) scdc.nodeport_start(self.np_tcp, scdc.NODEPORT_START_ASYNC_UNTIL_CANCEL) scdc.nodeport_start(self.np_stream, scdc.NODEPORT_START_LOOP_UNTIL_CANCEL) scdc.nodeport_stop(self.np_stream) scdc.nodeport_stop(self.np_tcp) scdc.nodeport_close(self.np_stream) scdc.nodeport_close(self.np_tcp)
def printmsg(s): print("jobrun_rel: " + s) scdc.log_init("log_FILE", sys.stdout, sys.stderr) printmsg("scdc init") scdc.init() basepath = "rel" dp_rel = scdc.dataprov_open(basepath, "jobrun_relay") np_tcp = scdc.nodeport_open("tcp:max_connections:", 2) signal.signal(signal.SIGABRT, sighandler) signal.signal(signal.SIGTERM, sighandler) signal.signal(signal.SIGINT, sighandler) scdc.nodeport_start(np_tcp, scdc.NODEPORT_START_LOOP_UNTIL_CANCEL) # running scdc.nodeport_stop(np_tcp) scdc.nodeport_close(np_tcp) scdc.dataprov_close(dp_rel)
scdc.log_init("log_FILE", sys.stdout, sys.stderr) scdc.init() simpat_init() np = None if len(sys.argv) <= 1: SIMPAT_TRACE("setup: none") elif sys.argv[1] == "uds": SIMPAT_TRACE("setup: UDS") socketname = "simpat" if len(sys.argv) <= 2 else sys.argv[2] np = scdc.nodeport_open("uds:socketname:max_connections", socketname, 2) elif sys.argv[1] == "tcp": SIMPAT_TRACE("setup: TCP") np = scdc.nodeport_open("tcp:max_connections", 2) elif sys.argv[1] == "mpi": SIMPAT_TRACE("setup: MPI") np = scdc.nodeport_open("mpi") else: SIMPAT_TRACE("unknown mode: " + argv[1]) SIMPAT_TRACE("start") scdc.nodeport_start(np, scdc.NODEPORT_START_ASYNC_UNTIL_CANCEL) #scdc.nodeport_start(np, scdc.NODEPORT_START_LOOP_UNTIL_CANCEL)
return True signal.signal(signal.SIGABRT, sighandler) signal.signal(signal.SIGTERM, sighandler) signal.signal(signal.SIGINT, sighandler) Z_TRACE("start hook demo") Z_TRACE() scdc.init() dp_hook = scdc.dataprov_open("hookdemo", "hook:id", hookdemo.hook, 0x2501) if NODEPORT_TCP != None: np_tcp = scdc.nodeport_open("tcp:max_connections", 2) if NODEPORT_STREAM != None: np_stream = scdc.nodeport_open("stream:cmd_handler", cmd_handler, None) scdc.nodeport_start(np_tcp, NODEPORT_TCP) scdc.nodeport_start(np_stream, NODEPORT_STREAM) scdc.nodeport_stop(np_stream) scdc.nodeport_stop(np_tcp) scdc.nodeport_close(np_stream) scdc.nodeport_close(np_tcp) scdc.dataprov_close(dp_hook) scdc.release()