{"id":18596818,"url":"https://github.com/bytekast/serverless-algo-scheduler","last_synced_at":"2025-06-27T22:37:26.563Z","repository":{"id":37888885,"uuid":"189166380","full_name":"bytekast/serverless-algo-scheduler","owner":"bytekast","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-06T16:30:39.000Z","size":486,"stargazers_count":0,"open_issues_count":19,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-16T13:09:38.386Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytekast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-29T06:44:47.000Z","updated_at":"2019-05-30T22:58:12.000Z","dependencies_parsed_at":"2023-01-24T10:16:14.958Z","dependency_job_id":null,"html_url":"https://github.com/bytekast/serverless-algo-scheduler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bytekast/serverless-algo-scheduler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytekast%2Fserverless-algo-scheduler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytekast%2Fserverless-algo-scheduler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytekast%2Fserverless-algo-scheduler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytekast%2Fserverless-algo-scheduler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytekast","download_url":"https://codeload.github.com/bytekast/serverless-algo-scheduler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytekast%2Fserverless-algo-scheduler/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262345938,"owners_count":23296799,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T01:25:51.607Z","updated_at":"2025-06-27T22:37:26.521Z","avatar_url":"https://github.com/bytekast.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless Algorithm Scheduler\n\n\nThis demo project shows how to build and deploy a \"real-world\" Serverless application. It demonstrates how to build a microservice that implement the following apis and features:\n\n### API Endpoint `POST /user/{username}/schedules`\n\nThis api endpoint accepts a payload that is persisted in a table in [DynamoDB](https://aws.amazon.com/dynamodb/). Here is a sample input:\n```json\n{\n  \"algorithm\": \"rowell/Hello/0.2.0\",\n  \"apikey\": \"simXXXXXXXXXXXXXXXX\",\n  \"input\": \"test input 123\",\n  \"run_interval_minutes\": 5,\n  \"enabled\": true\n}\n```\n\n```bash\ncurl -i -H \"Content-Type: application/json\" -X POST https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/user/rowell/schedules -d '{ \"algorithm\": \"rowell/Hello/0.2.0\", \"apikey\": \"simXXXXXXXXXXX\", \"input\": \"test input 123\", \"run_interval_minutes\": 5, \"enabled\": false}'\n```\n\nEssentially, this payload creates a job to run an algorithm in the [Algorithmia Marketplace](https://algorithmia.com/) every 5 minutes with the provided `input` text.\n\n### API Endpoint `GET /user/{username}/schedules`\n\nReturns the schedules created by the user.\n\n```bash\ncurl -X GET https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/user/rowell/schedules\n```\n\n\n### Scheduler Background Job\n\nThis function wakes up every minute, queries [DynamoDB](https://aws.amazon.com/dynamodb/) for schedules that need to be run at this moment and sends the jobs to a Job [SQS](https://aws.amazon.com/sqs/) queue.\n\n\n### Runner Event Listener\n\n\nThis function subscribes to the Job [SQS queue](https://aws.amazon.com/sqs/) and runs whenever a message is inserted. It receives the event, calls the [Algorithmia algorithm](https://algorithmia.com/developers/algorithm-development/algorithm-basics/your-first-algo), waits for the response and sends the result to a Result [SQS Queue](https://aws.amazon.com/sqs/).\n\n\n## 📦 Prerequisites\n\nInstall [Rust](https://www.rust-lang.org/tools/install).\n\nInstall [Node](https://www.npmjs.com/get-npm).\n\nInstall the [serverless framework](https://serverless.com/framework/) cli.\n\nInstall [Docker](https://docs.docker.com/install/). (Docker is only required to build native binaries compatible with [AWS Lambda](https://aws.amazon.com/lambda/))\n\nThen then run the following in your terminal\n\n```bash\nsls plugin install --name serverless-pseudo-parameters\n\nsls plugin install --name serverless-rust\n```\n\n\nYou also need to setup your AWS credentials/profiles in the `~/.aws/credentials` file.\n\n```\n[dev]\naws_access_key_id = XXXXXXXXXXXXXX\naws_secret_access_key = XXXXXXXXXXXXXX\nregion = us-east-1\n\n\n[prod]\naws_access_key_id = XXXXXXXXXXXXXX\naws_secret_access_key = XXXXXXXXXXXXXX\nregion = us-east-1\n```\n\n\n## 🦀 Build\n\nRun `cargo build`\n\n\n## 🛵 Deploy\n\nFirst, make sure docker is running.\n\nTo deploy, simply run `sls deploy`.\n\nTo deploy in a specific stage, provide the stage parameter `sls deploy --stage prod`.\n\nWhen finished, you should see a similar output:\n\n```bash\nServerless: Stack update finished...\nService Information\nservice: algo-scheduler\nstage: dev\nregion: us-east-1\nstack: algo-scheduler-dev\nresources: 35\napi keys:\n  algo-scheduler-dev: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nendpoints:\n  GET - https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/user/{username}/schedules\n  POST - https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/user/{username}/schedules\nfunctions:\n  get-user-schedules: algo-scheduler-dev-get-user-schedules\n  save-user-schedule: algo-scheduler-dev-save-user-schedule\n  scheduler: algo-scheduler-dev-scheduler\n  authorizer: algo-scheduler-dev-authorizer\n  runner: algo-scheduler-dev-runner\nlayers:\n  None\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytekast%2Fserverless-algo-scheduler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytekast%2Fserverless-algo-scheduler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytekast%2Fserverless-algo-scheduler/lists"}