Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge addtnl comments #480

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions nmdc_runtime/api/v1/workflows/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
)


async def job_to_db(job_spec: dict[str, Any], mdb: AsyncIOMotorDatabase) -> None:
return await mdb["jobs"].insert_one(job_spec)
# async def job_to_db(job_spec: dict[str, Any], mdb: AsyncIOMotorDatabase) -> None:
# return await mdb["jobs"].insert_one(job_spec)


@router.post("", status_code=status.HTTP_201_CREATED)
Expand All @@ -44,15 +44,18 @@ async def post_activity(
"""
_ = site # must be authenticated
try:
# verify activities in activity_set are nmdc-schema compliant
for collection_name in activity_set:
if collection_name not in activity_collection_names(mdb):
raise ValueError("keys must be nmdc-schema activity collection names`")
# validate request JSON
rv = validate_json(activity_set, mdb)
if rv["result"] == "errors":
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail=str(rv),
)
# create mongodb instance for dagster
mongo_resource = MongoDB(
host=os.getenv("MONGO_HOST"),
dbname=os.getenv("MONGO_DBNAME"),
Expand Down
Loading