Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

Cannot recognize the token foo

在DolphinDB database的GUI中,下列代码成功执行:

def foo(): 3  
login("admin","123456")
scheduleJob(`dailyfoofile1, "Daily Job 1", run {"/home/xjqian/testjob.dos"}, 16:14m, 2020.01.01, 2020.12.31, 'D');

但定时任务执行时,报以下异常:

Exception was raised when running the script [/home/xjqian/testjob.dos]:Syntax Error: [line #3] Cannot recognize the token foo

请问是怎么回事?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

在创建定时作业时,若作业函数是run一个脚本文件,因为序列化时只保存了文件名,没有保存文件内容,所以需要把依赖的自定义函数都放到脚本文件中,否则会因为找不到自定义的函数而执行失败。上述问题的定时任务运行脚本时,就是没找到foo的函数定义,因此需要把foo定义写入脚本文件testjob.dos中。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...