-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved processing, need testing and further refactoring...
- Loading branch information
Showing
13 changed files
with
447 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import logging | ||
|
||
from fastapi import APIRouter, HTTPException, status | ||
|
||
from ...container import container | ||
from ...services.jobservice import JobItem, JobRequest | ||
|
||
logger = logging.getLogger(__name__) | ||
router = APIRouter( | ||
prefix="/job", | ||
tags=["job"], | ||
) | ||
|
||
|
||
@router.post("/setup") | ||
def setup_job(job_request: JobRequest) -> JobItem: | ||
try: | ||
return container.job_service.setup_job_request(jobrequest=job_request) | ||
except ConnectionRefusedError as exc: | ||
raise HTTPException(status_code=status.HTTP_429_TOO_MANY_REQUESTS, detail=f"Error setting up job: {exc}") from exc | ||
|
||
|
||
@router.get("/trigger") | ||
def trigger_job(): | ||
"""triggers a job that was setup before. this call needs to be sent to primary only and via GPIO the nodes will execute the job.""" | ||
container.job_service.trigger_execute_job() | ||
|
||
|
||
@router.get("/list") | ||
def get_jobs(): | ||
"""triggers a job that was setup before. this call needs to be sent to primary only and via GPIO the nodes will execute the job.""" | ||
return container.job_service.db_get_list_as_dict() | ||
|
||
|
||
@router.get("/results/{job_id}") | ||
def get_results(job_id: str) -> JobItem: | ||
raise NotImplementedError | ||
# return container.job_service.get_job_results(job_id=job_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.