コード例 #1
0
async def set_training_state_to_initiated(workspace_id: ObjectId):
    await WorkspaceRepository(get_async_db()).set_training_state(
        workspace_id, TrainingState.TRAINING_INITIATED)
コード例 #2
0
async def get_prediction_key(prediction_id: ObjectId) -> PredictionKey:
    key = await MlModelRepository(get_async_db()
                                  ).get_prediction_key(prediction_id)
    return key
コード例 #3
0
async def generate_prediction_id_for_model(workspace_id: ObjectId,
                                           ml_model_id: ObjectId):
    key = PredictionKey(None, workspace_id=workspace_id, model_id=ml_model_id)
    return await MlModelRepository(get_async_db()).add_prediction_key(key)
コード例 #4
0
async def delete_ml_model_ref_from_workspace(workspace_id: ObjectId,
                                             ml_model_ref: ObjectId):
    await WorkspaceRepository(get_async_db()
                              ).delete_ml_model_ref(workspace_id, ml_model_ref)
コード例 #5
0
async def delete_ml_model(ml_model_id: ObjectId):
    await MlModelRepository(get_async_db()).delete_ml_model(ml_model_id)
コード例 #6
0
async def get_ml_model(ml_model_id: ObjectId) -> MlModel:
    model = await MlModelRepository(get_async_db()).get_ml_model(ml_model_id)
    return model
コード例 #7
0
async def add_workspace(workspace: Workspace):
    workspace_repository = WorkspaceRepository(get_async_db())
    if await workspace_repository.workspace_exists(workspace._id):
        raise HTTPException(status.HTTP_406_NOT_ACCEPTABLE,
                            detail="This workspace id is already in use.")
    await WorkspaceRepository(get_async_db()).add_workspace(workspace)
コード例 #8
0
async def get_workspace(workspace_id: ObjectId) -> Workspace:
    workspace = await WorkspaceRepository(get_async_db()
                                          ).get_workspace(workspace_id)
    return workspace