tombola careers
tombola careers


Blog | Tombola Careers

tombola blog
< back

AWS Task Scheduler

Posted by sohaib maroof
Introducing AWS Task Scheduler

Before I begin

Let me confess, I am not a great writer of words, more of code. So blogging, in general, is quite a challenge for me.

Why did we make a tool?

As a part of our 2020 roadmap, we are trying to offload as much processing intensive work from our monolithic architecture as possible.

This is to make as much room as we can to reach our 100K active daily players.

A part of this means not creating any new windows scheduled tasks or SQL scheduled jobs unless absolutely necessary. A good alternative is to use AWS Lambda functions or Docker containers to run as tasks.

Currently, we schedule these tasks in terraform, which means the scheduling is in code. This is starting to become a concern as we don’t have a consolidated view of what tasks run and when. Also, at present, we don’t have a means of quickly disabling or pausing a task if it becomes problematic.

Picture this scenario: You have a task that does a very simple job; sends out emails to customers who are opted in, that task is scheduled, now imagine if you want to change the schedule, you would have to do a code change and push it to production. Now I imagine if you send out, let us say a monthly player statement instead of a weekly one, you would have to deploy a whole new task for it? Whereas the only difference would be one word and the change in the schedule. To achieve this without having to do code change we proposed a solution in the form of a tool that will give us the ability to quickly and easily create, disable, delete and change how tasks are scheduled without the need for any code changes. This frees up the developer to concentrate on developing the task at hand rather than maintaining the code that describes the schedule. These two concerns become decoupled.

Where do I fit in this picture?

We had this project on the back burner for quite a while, but unlike the arcade and bingo teams, as a customer service aligned developer, I deal with Windows scheduled tasks and SQL scheduled jobs day in day out, therefore this was a well-suited project for me to see it through to production. Although a customer service aligned developer might use this more than anyone, it is a tool intended to be used by all territories throughout the company.

What is the Task Scheduler good for?

The task scheduler is intended to allow developers to schedule their computational tasks and manage them with ease. There are several features we required of the scheduler:

Task scheduler lists all the scheduled tasks whether it’s ECS task, lambda function, SQS queue or an SNS topic. You can drill down to each schedule to see which tasks it executes. This gives a complete and comprehensive overview of all the schedules in one place. It as can create, edit, disable and delete any schedule. It can attach multiple tasks to a single schedule. It has two types of audits; schedule audit and user activity audit. This gives a complete and thorough view of all the changes made to the schedule. Shown below is the screenshot of the schedule. It shows all the necessary information about a schedule and the tasks it will execute.

 schedule overview

Technologies Involved

Authentication and authorization: The application is domain authenticated so that only specific groups of people have access to it. For this purpose, we used passport.js together with Active Directory strategy for passport.js, as it perfectly fit our requirement. Passport is an authentication middleware for Node.js – Extremely flexible and modular, Passport can be unobtrusively dropped into any Express-based web application.

Task Scheduler is bootstrapped with Create React App together with Materialize. React makes it painless to create a single page application updating and rendering just the right components when the data changes. Materialize on the other hand is a modern responsive front-end framework; both sit in perfectly to provide a robust client-side experience.

Hope you enjoyed reading!

read more