简体   繁体   English

在Azure笔记本上安排

[英]Scheduling on Azure Notebooks

Is it possible to schedule a Python script on Azure Notebooks ? 是否可以在Azure笔记本上安排Python脚本?

I've written a simple script saved as test.py : 我写了一个保存为test.py的简单脚本: 在此输入图像描述

That runs absolutely fine when I run it in the terminal as 当我在终端中运行它时,它运行得非常好

python library/code/test.py

I've got a cron that looks like this: 我有一个看起来像这样的cron: 在此输入图像描述

But nothing is produced when I save the cron. 但是当我保存cron时没有产生任何东西。 I've set it as * * * * * so there's no opportunity for confusion with timezones just whilst I'm testing. 我把它设置为* * * * *所以在我测试时没有机会与时区混淆。

I can't find where the cron might be emailing me errors and outputs within the Azure environment. 我无法找到cron可能在Azure环境中通过电子邮件向我发送错误和输出的位置。 My root directory looks like this and there's nothing in mail : 我的根目录看起来像这样, mail没有任何内容:

在此输入图像描述

Have you tried to capture all the output. 您是否尝试捕获所有输出。 Here's a sample crontab entry set up to capture all the output: 这是一个示例crontab条目设置来捕获所有输出:

59 13 05 06 * { /usr/bin/python /path/to/myscript.py -i /path/to/input.txt --log --timer ; } > /tmp/myProj/myscriptPY.trace.`/bin/date +\%Y\%m\%d.\%H\%M` 2>&1

Simple idea is to save jupyter notebook to local and write a shell script to submit the python script. 简单的想法是将jupyter笔记本保存到本地并编写一个shell脚本来提交python脚本。 Something like /bin/bash -c "/path/to/python /path/to/script ...". /bin/bash -c "/path/to/python /path/to/script ...”之类的东西。 It could help,As it seems that cron uses /bin/sh to execute it's commands. 它可能会有所帮助,因为cron似乎使用/ bin / sh来执行它的命令。

Try this and see if it helps. 试试这个,看看它是否有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM