Pangeo Forge recipe handler for GCP Cloud Run.
To deploy, from within the /src directory:
$ gcloud run deploy $SERVICE_NAME --source .To get service url from service name:
$ gcloud run services describe $SERVICE_NAMETo invoke:
$ curl \
-X POST \
-H "Authorization: Bearer $(gcloud auth print-identity-token)" \
$SERVICE_URL \
--json $PAYLOAD_JSONor
$ curl \
-X POST \
-H "Authorization: Bearer $(gcloud auth print-identity-token)" \
-H "Content-Type: application/json" \
$SERVICE_URL \
-d $PAYLOAD_JSONCreate and activate a local conda environment from the file ci/env.yaml:
$ conda env create --file ci/env.yaml
$ conda activate cloudrunThen run the tests:
$ pytest src/testsNote: Because one of the features of this service is to modify its own environment, the tests also modify the test environment. This means the tests are somewhat long-running, but in exchange for this performance cost, we get the reassurance of testing the actual behavior (as opposed to faster, but potentially inaccurate, mocked tests).
The official Cloud Run docs have some good suggestions for testing locally with docker.