{"id":15905817,"url":"https://github.com/mukhopadhyay/rest-process-spawner","last_synced_at":"2026-04-26T23:31:55.568Z","repository":{"id":87565769,"uuid":"470269541","full_name":"Mukhopadhyay/rest-process-spawner","owner":"Mukhopadhyay","description":"Executing lengthy functions using python Rest API and processes.","archived":false,"fork":false,"pushed_at":"2022-04-02T20:50:56.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-24T20:38:01.127Z","etag":null,"topics":["api","fastapi","multi-processing","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mukhopadhyay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-03-15T17:42:11.000Z","updated_at":"2023-03-07T06:50:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"dc1af9e1-17a7-4883-8db8-ca2ddc6fe98d","html_url":"https://github.com/Mukhopadhyay/rest-process-spawner","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"721c88ab18ee8855bed4373d2f272a106460e41d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Mukhopadhyay/rest-process-spawner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mukhopadhyay%2Frest-process-spawner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mukhopadhyay%2Frest-process-spawner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mukhopadhyay%2Frest-process-spawner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mukhopadhyay%2Frest-process-spawner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mukhopadhyay","download_url":"https://codeload.github.com/Mukhopadhyay/rest-process-spawner/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mukhopadhyay%2Frest-process-spawner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32317163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"ssl_error","status_checked_at":"2026-04-26T23:26:25.802Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api","fastapi","multi-processing","python","python3"],"created_at":"2024-10-06T13:09:14.460Z","updated_at":"2026-04-26T23:31:55.552Z","avatar_url":"https://github.com/Mukhopadhyay.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rest-process-spawner\nExample scenario of executing lengthy functions using python Rest APIs and processes.\n\n## Description\nThe server is written in [FastAPI](https://fastapi.tiangolo.com/). But the idea works for FastAPI, flask alike. No async is used in this project. \n\n**Note:** I was stuck for some case like this some time back, so putting it up on my page, in case anyone finds this helpful :D\n\n## Usage\nConsider the scenario, where you need to run some method, which you know will take a long time to run, but you have nothing to do with its response / return. All you want to do is to run the method and be over with it.\nThis project is a boilerplate of how that can be dealt with using a rest API and a process based approach.\nCheckout the file named `router.py` in both of the `/create` endpoint handlers you'll see that we're creating and starting a process and be done with it. It is a very simple implementation, in your case however it may be more complex, but hopefully you get the idea!\n\nThe \"lengthy\" function in our case is as follows:\n```python\ndef take_some_time(n: Optional[int]=10) -\u003e None:\n    time.sleep(n)\n    return\n```\nYou'll find this in the `utils.py` script. Good luck!\n\n\n## Installing the dependencies\n```bash\npython -m pip install -r requirements.txt\n```\n\n## Starting the server\n```bash\nuvicorn app:app\n```\n\n\u003cimg src=\"./docs/swagger.png\" width=\"800px\"\u003e\n\n\u003csmall\u003e\u003ci\u003eImage: Endpoints in the application\u003c/i\u003e\u003c/small\u003e\n\nAs the server is running visit [`localhost:8000/docs`](http://localhost:8000/docs) to check out the endpoints.\n\n|Endpoint|Method|Description|\n|:-------|:-----|:----------|\n|`/create`|**GET**|Creates a process with a random value|\n|`/create`|**POST**|Creates a process with given value in request body|\n|`/processes`|**GET**|Get all processes and their details created by this API|\n|`/active`|**GET**|Get all active processes|\n|`/kill`|**GET**|Kill the most recent process|\n|`/kill_all`|**GET**|Kill all active processes|","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmukhopadhyay%2Frest-process-spawner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmukhopadhyay%2Frest-process-spawner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmukhopadhyay%2Frest-process-spawner/lists"}