Charles Leung
06/21/2023, 6:00 PMScript at './Script/ibes_pykx.py' encountered an exception: ValueError('signal only works in main thread')
. The code is trying to establish a connection and then run these processes on the connection itself. Any advice would be a HUGE help. Source code is below:
def setup():
token = subprocess.Popen('\\\\ccl\\data\\extlib\\KDBSecToken.exe', stdout=subprocess.PIPE).communicate()[0].decode('utf-8')
masterConn = kx.SyncQConnection( host='v-kdbr-01', port=5000, username='cleung', password=token, timeout=3.0 )
user = masterConn('.z.u')
print('User = ' + user.py())
port = masterConn('getProcessClient[`prefect_testing_base;`pykx_test]')
print('Port = ' + str(port.py()))
masterConn.close()
global conn
conn = kx.SyncQConnection( host='v-kdbr-01', port=port.py(), username='cleung', password=token)
user = conn('.z.u')
print('User = ' + user.py())
@flow()
def ibes_pykx():
setup()
logger = get_run_logger()
<http://logger.info|logger.info>("Initializing initial arguments")
dailyDates = conn('dailyDates: .dt.drb[.dt.shiftdateb[exec max date from QModelD;-3]; exec max date from QModelD];')
logFile = conn('inLogFile:`')
return finishIBES_result
if __name__ == "__main__":
ibes_pykx()
Charles Leung
06/22/2023, 6:17 PMRyan Peden
06/22/2023, 6:36 PMCharles Leung
06/22/2023, 8:48 PMRyan Peden
06/23/2023, 1:22 AMsignal.signal
is being called in your code or in a library you're using, but either way I don't think it can work inside a task because the Prefect engine runs tasks in a new thread.Ryan Peden
06/23/2023, 1:35 AMCharles Leung
06/28/2023, 5:29 PMCharles Leung
06/28/2023, 5:30 PMRasmus Lindqvist
07/07/2023, 6:32 AM