Azure 任务计划程序

发布于 2024-07-13 13:29:03 字数 345 浏览 6 评论 0原文

虽然这个问题是 Azure 特有的,但我确信这是云计算的常见情况。

我有一个需要在特定时间运行的任务列表。 通过窗口服务器,我可以使用任务计划程序并安排我的程序在特定时间运行。 我可以更进一步,创建一个 Windows 服务,该服务将按给定的时间间隔运行,然后执行适当的任务。

有人对云计算环境的最佳方法有建议吗?

我可以创建一个辅助角色,每秒轮询任务列表,然后将适当的任务放入由另一个辅助角色处理的队列中。

我可以创建一个每天运行一次的辅助角色,获取所有任务并将它们提交到队列中。 然后,处理器角色将从队列中取出一个项目并在适当的时间进行处理。

还有其他建议吗?

While this question is particular to Azure, I'm sure that it is a common situation for cloud computing in general.

I have a list of tasks that I need run at a certain time. With a window's server, I can use Task Scheduler and schedule my program to run at a certain time. I could go a step further and create a windows service that would run at a given interval and then execute the appropriate task.

Does anyone have a suggestion on the best approach is for a cloud computing environment?

I could create a worker role that polls the task list every second and then throws the appropriate task into a queue that is processed by another worker role.

I could create a worker role that would run once a day, grab all the tasks and submit them to a queue. The processor roles would then pull an item off the queue and process at the appropriate time.

Any other suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

流心雨 2024-07-20 13:29:03

您可以设置服务总线队列并将其用作调度程序。

通过设置 ScheduledEnqueueTimeUtc 将消息添加到所需的时间,此时该消息将显示在队列中。 在执行工作者/Web 角色中,您在该队列上设置一个接收器,一旦消息显示(即作业到期),它将立即获取作业。

这样做的好处是,您可以使用它来平衡多个实例之间的作业,并且由于计时器完全位于您的应用程序外部,因此您不必存储、恢复和管理它。 SB 会为您做这一切。

需要注意的是:SB 无法取消预定的消息。

You can set up a Service Bus Queue and use that as the scheduler.

Send messages into the queue by setting ScheduledEnqueueTimeUtc on the message to the desired time and the message will show up in the queue at that time. In the executing worker/web role you set up a receiver on that queue and that will then get the job as soon as the message shows up, i.e. the job is due.

The nice thing about that is that you can use this to balances jobs across multiple instances and since the timer is completely external to your app you don't have to store and resurrect and manage it. SB does all that for you.

One caveat: SB doesn't have facility to cancel scheduled messages.

神回复 2024-07-20 13:29:03

现在有几个选项可以在 Azure 上执行此操作

There are now a couple of options for doing this on Azure

沫尐诺 2024-07-20 13:29:03

重复:推荐一个 C# 任务调度库,其中推荐 Quartz.Net。 我最近在做一个项目,在Windows下成功地使用了这个。

Duplicate of: Recommend a C# Task Scheduling Library which recommends Quartz.Net. I have recently worked on a project that used this successfully under Windows.

爱殇璃 2024-07-20 13:29:03

我意识到这已经很老了,但这仍然是一个常见问题。 我在我的一台 Azure VM 上使用 Windows 任务计划程序。 它实施起来很简单,并且使您无需重新发明轮子。

http://www.voiceoftech.com/ swhitley/index.php/2011/07/windows-azure-task-scheduler/

I realize this is old, but it's still a common question. I'm using Windows Task Scheduler on one of my Azure VMs. It's simple to implement and saves you from having to reinvent the wheel.

http://www.voiceoftech.com/swhitley/index.php/2011/07/windows-azure-task-scheduler/

用心笑 2024-07-20 13:29:03

您可以尝试使用以下四种产品:

  1. Azure 辅助角色(云服务)
  2. Azure 调度程序服务
  3. Azure 移动服务调度程序
  4. Azure 网站 Web 作业

有关更多信息,请点击链接
Azure计划任务

Yo can try with the the four offerings:

  1. Azure Worker Roles (Cloud Service)
  2. Azure Scheduler service
  3. Azure Mobile Services scheduler
  4. Azure Websites Web Jobs

For more Information please follow the link
Azure Schedule Tasks

不必了 2024-07-20 13:29:03

您是否考虑过在 Azure 队列上使用可变的项目过期日期?

我发现了一种新颖的调度方法,它也适用于 Azure。 使用 ASP.NET 缓存项回调。 此处

Have you considered using variable expiration dates of items on an Azure queue?

I came across a novel approach for scheduling that should work on Azure too. Using ASP.NET Cache item callbacks. Here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文