{"id":18620529,"url":"https://github.com/simonsobs/scheduler-server","last_synced_at":"2025-11-03T12:30:21.067Z","repository":{"id":179297270,"uuid":"658821190","full_name":"simonsobs/scheduler-server","owner":"simonsobs","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-11T15:55:56.000Z","size":432,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-02-11T17:22:25.279Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/simonsobs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-26T14:58:00.000Z","updated_at":"2025-02-11T15:55:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"7616f4c0-2675-4d98-b172-5d1a0c4edbfd","html_url":"https://github.com/simonsobs/scheduler-server","commit_stats":null,"previous_names":["simonsobs/scheduler-server"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsobs%2Fscheduler-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsobs%2Fscheduler-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsobs%2Fscheduler-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsobs%2Fscheduler-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonsobs","download_url":"https://codeload.github.com/simonsobs/scheduler-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239413790,"owners_count":19634307,"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-07T04:06:40.845Z","updated_at":"2025-11-03T12:30:21.036Z","avatar_url":"https://github.com/simonsobs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scheduler-server\n\n[![Image Builds](https://img.shields.io/github/actions/workflow/status/simonsobs/scheduler-server/build.yaml?branch=main)](https://github.com/simonsobs/scheduler-server/actions/workflows/build.yaml?query=workflow%3A%22Publish+Images+to+Container+Registries%22)\n[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue)](https://hub.docker.com/r/simonsobs/scheduler-server)\n\n## Related Packages\n\n* [**scheduler**](https://github.com/simonsobs/scheduler) - The core scheduling\n  library, a.k.a. `schedlib`.\n* [**scheduler-server**](https://github.com/simonsobs/scheduler-server) - This\n  package. The Flask API for fetching schedules.\n* [**scheduler-web**](https://github.com/simonsobs/scheduler-web) - The web\n  front end for the scheduler.\n\n## Installation\nFirst clone this repository, and then install it with\n```bash\npip install -r requirements.txt\npip install -e .\n```\n## Launch\nLaunching it requires `gunicorn` to be available. If we are inside this directory, run\n```bash\ngunicorn --bind localhost:8010 scheduler_server.app:app\n```\n\n### Docker\nAlternatively, you can launch the server in a docker container:\n```bash\ndocker run --rm -p 8010:8010 scheduler-server\n```\n\n## Schedule API\nThe API is temporarily hosted here: https://scheduler-uobd.onrender.com\n\n### Endpoint\n`POST /api/v1/schedule/`\n\n### Purpose\nThe Schedule API is used to generate a schedule of commands.\n\n### Request\nThe API expects a JSON object in the request body with the following properties:\n\n- `t0`: a string representing the start time in the format \"YYYY-MM-DD HH:MM\"\n- `t1`: a string representing the end time in the format \"YYYY-MM-DD HH:MM\"\n- `policy`: a json string representing the scheduling policy. It should contain a `\"policy\"` key which specify the name of the policy and a `\"config\"` key which contains a dictionary of configurations for this given policy. The provided configuration will overwrite the default configuration used. Current supported policy names: `\"dummy\"` and `\"basic\"`.  \n\n### Response\n\nThe API returns a JSON object with the following properties:\n- `status`: a string indicating the status of the request, either 'ok' or 'error'\n- `commands`: a string representing the generated schedule of commands\n- `message`: a string representing the message of the request\n\nThe API will return a HTTP status code of 200 OK on success and 400 Bad Request on error.\n\n### Example\n\nRequest:\n```\nPOST /api/v1/schedule/\n{\n\"t0\": \"2022-01-01 12:00\",\n\"t1\": \"2022-01-01 14:00\",\n\"policy\": {\"policy\": \"dummy\", \"config\": {}}\n}\n```\n\nSuccessful Response:\n```\n{\n\"status\": \"ok\",\n\"commands\": \"import time\\ntime.sleep(1)\\ntime.sleep(1)\\ntime.sleep(1)\\n\",\n\"message\": \"Success\"\n}\n```\n\nUnsuccessful Response:\n```\n{\n\"status\": \"error\",\n\"message\": \"Invalid input\"\n}\n```\n\nTest with Curl\n```bash\ncurl -L -X POST -H \"Content-Type: application/json\" -d '{\"t0\": \"2022-01-01 12:00\", \"t1\": \"2022-01-01 14:00\", \"policy\": \"{\\\"policy\\\": \\\"dummy\\\", \\\"config\\\": {}}\"}' http://127.0.0.1:8010/api/v1/schedule\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonsobs%2Fscheduler-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonsobs%2Fscheduler-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonsobs%2Fscheduler-server/lists"}