kopia lustrzana https://github.com/bugout-dev/moonstream
Add black formating.
rodzic
373f768a3f
commit
5485a73b98
|
@ -23,12 +23,15 @@ from ..settings import bugout_client as bc
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
router = APIRouter(prefix="/queries",)
|
router = APIRouter(
|
||||||
|
prefix="/queries",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.post("/{query_id}/update", tags=["queries"])
|
@router.post("/{query_id}/update", tags=["queries"])
|
||||||
async def update_query_data_handler(
|
async def update_query_data_handler(
|
||||||
request: Request, query_id: str = Query(...),
|
request: Request,
|
||||||
|
query_id: str = Query(...),
|
||||||
) -> Optional[Dict[str, Any]]:
|
) -> Optional[Dict[str, Any]]:
|
||||||
"""
|
"""
|
||||||
Request update data on S3 bucket
|
Request update data on S3 bucket
|
||||||
|
|
|
@ -80,14 +80,17 @@ async def now_handler() -> data.NowResponse:
|
||||||
|
|
||||||
@app.post("/jobs/stats_update", tags=["jobs"])
|
@app.post("/jobs/stats_update", tags=["jobs"])
|
||||||
async def status_handler(
|
async def status_handler(
|
||||||
stats_update: data.StatsUpdateRequest, background_tasks: BackgroundTasks,
|
stats_update: data.StatsUpdateRequest,
|
||||||
|
background_tasks: BackgroundTasks,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Update dashboard endpoint create are tasks for update.
|
Update dashboard endpoint create are tasks for update.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
dashboard_resource: BugoutResource = bc.get_resource(
|
dashboard_resource: BugoutResource = bc.get_resource(
|
||||||
token=stats_update.token, resource_id=stats_update.dashboard_id, timeout=10,
|
token=stats_update.token,
|
||||||
|
resource_id=stats_update.dashboard_id,
|
||||||
|
timeout=10,
|
||||||
)
|
)
|
||||||
|
|
||||||
# get all user subscriptions
|
# get all user subscriptions
|
||||||
|
@ -167,7 +170,9 @@ async def status_handler(
|
||||||
|
|
||||||
@app.post("/jobs/{query_id}/query_update", tags=["jobs"])
|
@app.post("/jobs/{query_id}/query_update", tags=["jobs"])
|
||||||
async def queries_data_update_handler(
|
async def queries_data_update_handler(
|
||||||
query_id: str, query: Any, background_tasks: BackgroundTasks,
|
query_id: str,
|
||||||
|
query: Any,
|
||||||
|
background_tasks: BackgroundTasks,
|
||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
|
|
||||||
s3_client = boto3.client("s3")
|
s3_client = boto3.client("s3")
|
||||||
|
@ -187,7 +192,10 @@ async def queries_data_update_handler(
|
||||||
|
|
||||||
stats_presigned_url = s3_client.generate_presigned_url(
|
stats_presigned_url = s3_client.generate_presigned_url(
|
||||||
"get_object",
|
"get_object",
|
||||||
Params={"Bucket": "queries_bucket", "Key": f"queries/{query_id}/data.json",},
|
Params={
|
||||||
|
"Bucket": "queries_bucket",
|
||||||
|
"Key": f"queries/{query_id}/data.json",
|
||||||
|
},
|
||||||
ExpiresIn=300000,
|
ExpiresIn=300000,
|
||||||
HttpMethod="GET",
|
HttpMethod="GET",
|
||||||
)
|
)
|
||||||
|
|
Ładowanie…
Reference in New Issue