From d6cdc3b35f69e66a0d7aa5e1404057f3b0e0e4d0 Mon Sep 17 00:00:00 2001 From: Colton Hicks Date: Tue, 19 Jul 2022 18:23:22 -0700 Subject: [PATCH] Changed project name from qccloud_server to chemcloud_server --- .circleci/config.yml | 18 ++-- .vscode/settings.json | 1 + CHANGELOG.md | 5 + Pipfile | 2 +- Pipfile.lock | 92 +++++++++---------- README.md | 25 +++-- .../__init__.py | 0 {qccloud_server => chemcloud_server}/auth.py | 4 +- .../config.py | 2 +- {qccloud_server => chemcloud_server}/main.py | 8 +- .../models.py | 4 +- .../routes/__init__.py | 0 .../routes/compute.py | 4 +- .../routes/helpers.py | 28 +++--- .../routes/oauth.py | 4 +- .../routes/users.py | 10 +- docker/context.dev | 2 +- docker/context.prod | 2 +- docker/docker-compose.local.yaml | 16 ++-- docker/server.dockerfile | 4 +- mypy.ini | 2 +- scripts/example.py | 4 +- setup.cfg | 2 +- tests/conftest.py | 8 +- tests/test_compute.py | 8 +- tests/test_helpers.py | 2 +- tests/utils.py | 2 +- 27 files changed, 132 insertions(+), 127 deletions(-) rename {qccloud_server => chemcloud_server}/__init__.py (100%) rename {qccloud_server => chemcloud_server}/auth.py (97%) rename {qccloud_server => chemcloud_server}/config.py (98%) rename {qccloud_server => chemcloud_server}/main.py (86%) rename {qccloud_server => chemcloud_server}/models.py (98%) rename {qccloud_server => chemcloud_server}/routes/__init__.py (100%) rename {qccloud_server => chemcloud_server}/routes/compute.py (96%) rename {qccloud_server => chemcloud_server}/routes/helpers.py (91%) rename {qccloud_server => chemcloud_server}/routes/oauth.py (96%) rename {qccloud_server => chemcloud_server}/routes/users.py (89%) diff --git a/.circleci/config.yml b/.circleci/config.yml index d4c6c58..04e285a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,9 +12,9 @@ parameters: type: string default: mtzgroup - qcc_docker_repo: + chemcloud_docker_repo: type: string - default: qccloud-server + default: chemcloud-server server_stacks_directory: type: string @@ -50,8 +50,8 @@ jobs: - image: circleci/python:3.9 - image: rabbitmq:3.8-alpine - image: redis:6-alpine - - image: coltonbh/bigqc-worker - command: celery -A bigqc.tasks worker -Q celery,private_queue --without-heartbeat --without-mingle --without-gossip --loglevel=INFO + - image: coltonbh/bigchem-worker + command: celery -A bigchem.tasks worker -Q celery,private_queue --without-heartbeat --without-mingle --without-gossip --loglevel=INFO steps: - checkout - restore_cache: @@ -108,7 +108,7 @@ jobs: key: v2-pipfile-lock-{{checksum "Pipfile.lock"}} - run: name: isort - command: isort --check-only --diff qccloud_server tests + command: isort --check-only --diff chemcloud_server tests mypy: resource_class: small docker: @@ -178,14 +178,14 @@ jobs: - image: cimg/base:2020.01 environment: DOCKER_COMPOSE_FILENAME: docker-compose.web.yaml - SERVER_FILEPATH: << pipeline.parameters.server_stacks_directory >>/qcc + SERVER_FILEPATH: << pipeline.parameters.server_stacks_directory >>/chemcloud steps: - checkout - add_ssh_keys: fingerprints: - << parameters.ssh-fingerprint >> - full_image_name: - docker_repo: << pipeline.parameters.qcc_docker_repo >> + docker_repo: << pipeline.parameters.chemcloud_docker_repo >> - run: name: Fill docker-compose template with context command: | @@ -207,7 +207,7 @@ jobs: ssh root@${MTZLAB_SWARM_HOST} ESCAPED_DOCKERHUB_PASSWORD=${ESCAPED_DOCKERHUB_PASSWORD} DOCKERHUB_USERNAME=${DOCKERHUB_USERNAME} "echo ${ESCAPED_DOCKERHUB_PASSWORD} | docker login -u ${DOCKERHUB_USERNAME} --password-stdin" # pragma: allowlist secret - run: name: Deploy docker stack on server - command: ssh root@${MTZLAB_SWARM_HOST} "docker stack deploy --prune --with-registry-auth -c ${SERVER_FILEPATH}/${DOCKER_COMPOSE_FILENAME} qcc" + command: ssh root@${MTZLAB_SWARM_HOST} "docker stack deploy --prune --with-registry-auth -c ${SERVER_FILEPATH}/${DOCKER_COMPOSE_FILENAME} chemcloud" workflows: main: @@ -244,7 +244,7 @@ workflows: requires: - test_code - build_web_approval - docker_repo: qccloud-server + docker_repo: chemcloud-server dockerfile_name: server.dockerfile filters: tags: diff --git a/.vscode/settings.json b/.vscode/settings.json index 4c47ed0..e4e1598 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,6 +3,7 @@ "amqp", "amqps", "BERNY", + "bigchem", "bigqc", "dtype", "freqs", diff --git a/CHANGELOG.md b/CHANGELOG.md index e89e003..df57eb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [unreleased] +### Changed + +- Changed projects name from `QCCloud` to `ChemCloud` +- Updated `bigqc` to `bigchem` + ## [0.8.1] - 2022-07-15 ### Changed diff --git a/Pipfile b/Pipfile index 663ea15..161f24b 100644 --- a/Pipfile +++ b/Pipfile @@ -31,7 +31,7 @@ tcpb = ">=0.12.0" cached-property = "*" qcelemental = "==0.24.0" fastapi = "==0.65.1" -bigqc = {ref = "0.1.3", git = "https://github.com/coltonbh/bigqc.git"} +bigchem = {ref = "0.2.0", git = "https://github.com/coltonbh/bigchem.git"} [requires] python_version = "3.9" diff --git a/Pipfile.lock b/Pipfile.lock index 94b7610..ee0822b 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "c985e118db13c44b1d88a57744db79ca2576f45683b6ebd16cd422445fd4084c" + "sha256": "7de374a9d2ea6762e52f4027a05d4f602ca1bee09f9b60d2f195908bcd802ff8" }, "pipfile-spec": 6, "requires": { @@ -56,9 +56,9 @@ "markers": "python_version >= '3.6'", "version": "==4.11.1" }, - "bigqc": { - "git": "https://github.com/coltonbh/bigqc.git", - "ref": "32543bc5c658f0d5ebbb54d77bec66635097f19d" + "bigchem": { + "git": "https://github.com/coltonbh/bigchem.git", + "ref": "ee9baea0159d92b14c98108db975652b60fc5b44" }, "billiard": { "hashes": [ @@ -185,7 +185,7 @@ "sha256:a0713dc7a1de3f06bc0df5a9567ad19ead2d3d5689b434768a6145bff77c0667", "sha256:f184f0d851d96b6d29297354ed981b7dd71df7ff500d82fa6d11f0856bee8035" ], - "markers": "python_version < '4' and python_full_version >= '3.6.2'", + "markers": "python_version < '4.0' and python_full_version >= '3.6.2'", "version": "==0.3.0" }, "click-plugins": { @@ -355,11 +355,11 @@ }, "networkx": { "hashes": [ - "sha256:5e53f027c0d567cf1f884dbb283224df525644e43afd1145d64c9d88a3584762", - "sha256:6933b9b3174a0bdf03c911bb4a1ee43a86ce3edeb813e37e1d4c553b3f4a2c4f" + "sha256:15a7b81a360791c458c55a417418ea136c13378cfdc06a2dcdc12bd2f9cf09c1", + "sha256:a762f4b385692d9c3a6f2912d058d76d29a827deaedf9e63ed14d397b8030687" ], "markers": "python_version >= '3.8'", - "version": "==2.8.4" + "version": "==2.8.5" }, "numpy": { "hashes": [ @@ -673,16 +673,16 @@ "sha256:5c6bd9dc7a543b7fe4304a631f8a8a3b674e2bbfc49c2ae96200cdbe55df6b17", "sha256:95c5d300c4e879ee69708c428ba566c59478fd653cc3a22243eeb8ed846950bb" ], - "markers": "python_version >= '3.6' and python_version < '4'", + "markers": "python_version >= '3.6' and python_version < '4.0'", "version": "==4.8" }, "setuptools": { "hashes": [ - "sha256:16923d366ced322712c71ccb97164d07472abeecd13f3a6c283f6d5d26722793", - "sha256:db3b8e2f922b2a910a29804776c643ea609badb6a32c4bcc226fd4fd902cce65" + "sha256:0d33c374d41c7863419fc8f6c10bfe25b7b498aa34164d135c622e52580c6b16", + "sha256:c04b44a57a6265fe34a4a444e965884716d34bae963119a76353434d6f18e450" ], "markers": "python_version >= '3.7'", - "version": "==63.1.0" + "version": "==63.2.0" }, "six": { "hashes": [ @@ -977,10 +977,10 @@ }, "distlib": { "hashes": [ - "sha256:6564fe0a8f51e734df6333d08b8b94d4ea8ee6b99b5ed50613f731fd4089f34b", - "sha256:e4b58818180336dc9c529bfb9a0b58728ffc09ad92027a3f30b7cd91e3458579" + "sha256:a7f75737c70be3b25e2bee06288cec4e4c221de18455b2dd037fe2a795cab2fe", + "sha256:b710088c59f06338ca514800ad795a132da19fda270e3ce4affc74abf955a26c" ], - "version": "==0.3.4" + "version": "==0.3.5" }, "filelock": { "hashes": [ @@ -1038,32 +1038,32 @@ }, "mypy": { "hashes": [ - "sha256:006be38474216b833eca29ff6b73e143386f352e10e9c2fbe76aa8549e5554f5", - "sha256:03c6cc893e7563e7b2949b969e63f02c000b32502a1b4d1314cabe391aa87d66", - "sha256:0e9f70df36405c25cc530a86eeda1e0867863d9471fe76d1273c783df3d35c2e", - "sha256:1ece702f29270ec6af25db8cf6185c04c02311c6bb21a69f423d40e527b75c56", - "sha256:3e09f1f983a71d0672bbc97ae33ee3709d10c779beb613febc36805a6e28bb4e", - "sha256:439c726a3b3da7ca84a0199a8ab444cd8896d95012c4a6c4a0d808e3147abf5d", - "sha256:5a0b53747f713f490affdceef835d8f0cb7285187a6a44c33821b6d1f46ed813", - "sha256:5f1332964963d4832a94bebc10f13d3279be3ce8f6c64da563d6ee6e2eeda932", - "sha256:63e85a03770ebf403291ec50097954cc5caf2a9205c888ce3a61bd3f82e17569", - "sha256:64759a273d590040a592e0f4186539858c948302c653c2eac840c7a3cd29e51b", - "sha256:697540876638ce349b01b6786bc6094ccdaba88af446a9abb967293ce6eaa2b0", - "sha256:9940e6916ed9371809b35b2154baf1f684acba935cd09928952310fbddaba648", - "sha256:9f5f5a74085d9a81a1f9c78081d60a0040c3efb3f28e5c9912b900adf59a16e6", - "sha256:a5ea0875a049de1b63b972456542f04643daf320d27dc592d7c3d9cd5d9bf950", - "sha256:b117650592e1782819829605a193360a08aa99f1fc23d1d71e1a75a142dc7e15", - "sha256:b24be97351084b11582fef18d79004b3e4db572219deee0212078f7cf6352723", - "sha256:b88f784e9e35dcaa075519096dc947a388319cb86811b6af621e3523980f1c8a", - "sha256:bdd5ca340beffb8c44cb9dc26697628d1b88c6bddf5c2f6eb308c46f269bb6f3", - "sha256:d5aaf1edaa7692490f72bdb9fbd941fbf2e201713523bdb3f4038be0af8846c6", - "sha256:e999229b9f3198c0c880d5e269f9f8129c8862451ce53a011326cad38b9ccd24", - "sha256:f4a21d01fc0ba4e31d82f0fff195682e29f9401a8bdb7173891070eb260aeb3b", - "sha256:f4b794db44168a4fc886e3450201365c9526a522c46ba089b55e1f11c163750d", - "sha256:f730d56cb924d371c26b8eaddeea3cc07d78ff51c521c6d04899ac6904b75492" + "sha256:02ef476f6dcb86e6f502ae39a16b93285fef97e7f1ff22932b657d1ef1f28655", + "sha256:0d054ef16b071149917085f51f89555a576e2618d5d9dd70bd6eea6410af3ac9", + "sha256:19830b7dba7d5356d3e26e2427a2ec91c994cd92d983142cbd025ebe81d69cf3", + "sha256:1f7656b69974a6933e987ee8ffb951d836272d6c0f81d727f1d0e2696074d9e6", + "sha256:23488a14a83bca6e54402c2e6435467a4138785df93ec85aeff64c6170077fb0", + "sha256:23c7ff43fff4b0df93a186581885c8512bc50fc4d4910e0f838e35d6bb6b5e58", + "sha256:25c5750ba5609a0c7550b73a33deb314ecfb559c350bb050b655505e8aed4103", + "sha256:2ad53cf9c3adc43cf3bea0a7d01a2f2e86db9fe7596dfecb4496a5dda63cbb09", + "sha256:3fa7a477b9900be9b7dd4bab30a12759e5abe9586574ceb944bc29cddf8f0417", + "sha256:40b0f21484238269ae6a57200c807d80debc6459d444c0489a102d7c6a75fa56", + "sha256:4b21e5b1a70dfb972490035128f305c39bc4bc253f34e96a4adf9127cf943eb2", + "sha256:5a361d92635ad4ada1b1b2d3630fc2f53f2127d51cf2def9db83cba32e47c856", + "sha256:77a514ea15d3007d33a9e2157b0ba9c267496acf12a7f2b9b9f8446337aac5b0", + "sha256:855048b6feb6dfe09d3353466004490b1872887150c5bb5caad7838b57328cc8", + "sha256:9796a2ba7b4b538649caa5cecd398d873f4022ed2333ffde58eaf604c4d2cb27", + "sha256:98e02d56ebe93981c41211c05adb630d1d26c14195d04d95e49cd97dbc046dc5", + "sha256:b793b899f7cf563b1e7044a5c97361196b938e92f0a4343a5d27966a53d2ec71", + "sha256:d1ea5d12c8e2d266b5fb8c7a5d2e9c0219fedfeb493b7ed60cd350322384ac27", + "sha256:d2022bfadb7a5c2ef410d6a7c9763188afdb7f3533f22a0a32be10d571ee4bbe", + "sha256:d3348e7eb2eea2472db611486846742d5d52d1290576de99d59edeb7cd4a42ca", + "sha256:d744f72eb39f69312bc6c2abf8ff6656973120e2eb3f3ec4f758ed47e414a4bf", + "sha256:ef943c72a786b0f8d90fd76e9b39ce81fb7171172daf84bf43eaf937e9f220a9", + "sha256:f2899a3cbd394da157194f913a931edfd4be5f274a88041c9dc2d9cdcb1c315c" ], "index": "pypi", - "version": "==0.961" + "version": "==0.971" }, "mypy-extensions": { "hashes": [ @@ -1224,11 +1224,11 @@ }, "setuptools": { "hashes": [ - "sha256:16923d366ced322712c71ccb97164d07472abeecd13f3a6c283f6d5d26722793", - "sha256:db3b8e2f922b2a910a29804776c643ea609badb6a32c4bcc226fd4fd902cce65" + "sha256:0d33c374d41c7863419fc8f6c10bfe25b7b498aa34164d135c622e52580c6b16", + "sha256:c04b44a57a6265fe34a4a444e965884716d34bae963119a76353434d6f18e450" ], "markers": "python_version >= '3.7'", - "version": "==63.1.0" + "version": "==63.2.0" }, "six": { "hashes": [ @@ -1256,11 +1256,11 @@ }, "types-requests": { "hashes": [ - "sha256:acd8ed78509d27bdf04cddcc05f7066dfde4d30dd7dba67b808cdb1141d62ffe", - "sha256:b097692e124001f0ed5e4490245bb090f5e8e929819972f9ace84f9c3e146e8c" + "sha256:398f88cd9302c796cb63d1021af2a1fb7ae507741a3d508edf8e0746d8c16a04", + "sha256:c164696bfdce0123901165c5f097a6cc4f6326268c65815d4b6a57eacfec5e81" ], "index": "pypi", - "version": "==2.28.1" + "version": "==2.28.2" }, "types-urllib3": { "hashes": [ @@ -1282,7 +1282,7 @@ "sha256:8298d6d56d39be0e3bc13c1c97d133f9b45d797169a0e11cdd0e0489d786f7ec", "sha256:879ba4d1e89654d9769ce13121e0f94310ea32e8d2f8cf587b77c08bbcdb30d6" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4.0'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4'", "version": "==1.26.10" }, "virtualenv": { diff --git a/README.md b/README.md index 2abe349..36efb03 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Quantum Chemistry Cloud +# ChemCloud -Perform quantum calculations in the cloud. Interactive API documentation [here](https://qccloud.mtzlab.com/docs) +Perform computational chemistry calculations via http requests/responses. Interactive API documentation [here](https://chemcloud.mtzlab.com/docs) ## Development @@ -17,7 +17,7 @@ pipenv run pre-commit install # installs hooks for commit stage pipenv run pre-commit install --hook-type pre-push # install hooks for push stage ``` -### Run local Quantum Chemistry Cloud for dev +### Run local ChemCloud for dev Run webserver, redis backend, rabbitmq broker, and Psi4-powered non-GPU accelerated worker instance. This command will build images for the web server and for the celery worker. It will mount the local code into the webserver so that it hot-reloads any changes made to the codebase. The worker can actively pickup tasks and run them. @@ -39,21 +39,21 @@ For more granularity you can use docker to run various components of the service docker-compose -f docker/docker-compose.local.yaml up -d --build [services_of_interest] ``` -Run non-dockerized local bigqc worker +Run non-dockerized local bigchem worker ```sh -pipenv run celery -A qccloud_server.workers.tasks worker --loglevel=INFO +pipenv run celery -A chemcloud_server.workers.tasks worker --loglevel=INFO ``` Run non-dockerized web server ```sh -pipenv run uvicorn qccloud_server.main:app --reload +pipenv run uvicorn chemcloud_server.main:app --reload ``` ### Development on Fire (or any machine with GPUs) -Developing on a machine with GPUs means you can run `TeraChem` in server mode and the `BigQC` worker can send work to it. Simply include `terachem` and `file-server` in the list of `services_of_interest` in the `docker-compose` commands noted above. +Developing on a machine with GPUs means you can run `TeraChem` in server mode and the `BigChem` worker can send work to it. Simply include `terachem` and `file-server` in the list of `services_of_interest` in the `docker-compose` commands noted above. If you can't run a modern version of `docker-compose` that has good GPU support, you can run the `TeraChem` worker as a separation container and network it to the `QC Cloud` stack. The additional `docker-compose.fire.yaml` file places all services on an external `qcc` network. Then when starting terachem via the docker command below it is also added to the network. The .env variable `TERACHEM_PBS_HOST` must be set to the name of the terachem container (named `terachem` below) @@ -68,7 +68,7 @@ docker stop qcc_worker ### Manage environment and Auth0 for local development -Settings are managed in `qccloud_server/config` and the `Settings` object will automatically look for environment variables found in both the environment and a `.env` file. If you need authentication to work for local development add the following variables to a `.env` file in the root directory with their corresponding values. These values are not required for tests to run correctly, though authentication-required endpoints will not work if hand-testing since a mocked auth system for local development has not been created. +Settings are managed in `chemcloud_server/config` and the `Settings` object will automatically look for environment variables found in both the environment and a `.env` file. If you need authentication to work for local development add the following variables to a `.env` file in the root directory with their corresponding values. These values are not required for tests to run correctly, though authentication-required endpoints will not work if hand-testing since a mocked auth system for local development has not been created. ``` AUTH0_DOMAIN= @@ -90,16 +90,15 @@ A test summary will be output to `/htmlcov`. Open `/htmlcov/index.html` to get a ## Deployment - Full CI/CD is handled via [CircleCi](https://circleci.com). See `.circleci/config.yml` for details. -- NOTE: If you add celery tasks you'll need to rebuild and push the `mtzgroup/qccloud-cloud-worker:testing` image that the CI/CD pipeline uses for tests. This worker image is a build of the `docker/celeryworker.dockerfile` image. CircleCi pulls this image from the `mtzgroup` Docker Hub account when it runs the CI/CD pipeline rather than building it from scratch each time since it takes ages to build the image on the small, free CircleCI servers. ### Web Services - In the directory on the server from which the `docker-compose.web.yaml` file will deploy, create the following files and populate with their correct secrets: - server.env - `BASE_URL=https://yourdomain.com` - - `BIGQC_BROKER_URL=amqp://${USERNAME}:${PASSWORD}@mq:5672` # pragma: allowlist secret + - `BIGCHEM_BROKER_URL=amqp://${USERNAME}:${PASSWORD}@mq:5672` # pragma: allowlist secret - Note that the host should correspond to the service name for the `rabbitmq` instance found in the `docker-compose.web.yaml` file since we want the web server to connect locally rather than over the open internet. Also, note we are connecting to the port on which `rabbitmq` is running _insecurely_ on the stack. Traefik is providing TLS termination for external services that must connect _securely_ to `rabbit`. - - `BIGQC_BACKEND_URL=redis://:${PASSWORD}@redis:6379/0` + - `BIGCHEM_BACKEND_URL=redis://:${PASSWORD}@redis:6379/0` - See note above for `rabbitmq`. Same logic applies. - `AUTH0_DOMAIN=xxx` - `AUTH0_CLIENT_ID=xxx` @@ -114,7 +113,7 @@ A test summary will be output to `/htmlcov`. Open `/htmlcov/index.html` to get a ### Workers - In the directory on the server from which the `docker-compose.worker.yaml` file will deploy, create the following files and populate with their correct secrets: - - `BIGQC_BROKER_URL=amqps://${USERNAME}:${PASSWORD}@rmq.dev.mtzlab.com:5671` + - `BIGCHEM_BROKER_URL=amqps://${USERNAME}:${PASSWORD}@rmq.dev.mtzlab.com:5671` - Note the amqpS protocol. Since we are connecting over the open internet we require TLS. Also note the use of the `5671` _secure_ port for `amqps` connections. This is the port on which `traefik` is listening for `amqps` connections. - - `BIGQC_BACKEND_URL=rediss://:${PASSWORD}@redis.dev.mtzlab.com:6379/0?ssl_cert_reqs=CERT_NONE` + - `BIGCHEM_BACKEND_URL=rediss://:${PASSWORD}@redis.dev.mtzlab.com:6379/0?ssl_cert_reqs=CERT_NONE` - Same logic for the `rabbitmq` connection string applies here. Note that we do not verify the SSL certificate. This is because `traefik` is dynamically generating and renewing SSL certificates so we do not have a "permanent" certificate that we can place on the client and use for verification. Very low risk of man-in-the-middle attacks here. diff --git a/qccloud_server/__init__.py b/chemcloud_server/__init__.py similarity index 100% rename from qccloud_server/__init__.py rename to chemcloud_server/__init__.py diff --git a/qccloud_server/auth.py b/chemcloud_server/auth.py similarity index 97% rename from qccloud_server/auth.py rename to chemcloud_server/auth.py index 48180a9..bef30cb 100644 --- a/qccloud_server/auth.py +++ b/chemcloud_server/auth.py @@ -5,7 +5,7 @@ from fastapi.security.oauth2 import SecurityScopes from jose import jwt -from qccloud_server import config +from chemcloud_server import config from .config import get_settings @@ -13,7 +13,7 @@ tokenUrl="/api/v1/oauth/token", scopes={ "compute:public": "Perform computations and retrieve results as a public user.", - "compute:private": "Perform computations and retrieve results computed on private Quantum Chemistry Connect instances.", + "compute:private": "Perform computations and retrieve results computed on private ChemCloud Connect instances.", }, ) diff --git a/qccloud_server/config.py b/chemcloud_server/config.py similarity index 98% rename from qccloud_server/config.py rename to chemcloud_server/config.py index 31f8d58..232c05d 100644 --- a/qccloud_server/config.py +++ b/chemcloud_server/config.py @@ -29,7 +29,7 @@ class Settings(BaseSettings): max_batch_inputs: int = 100 # Finite difference step hessian_default_dh: float = 5.0e-3 - bigqc_keywords: str = "bigqc:keywords" + bigchem_keywords: str = "bigchem:keywords" # NOTE: Adding "" values as defaults so tests can run on CircleCi without having # to set these auth0 values diff --git a/qccloud_server/main.py b/chemcloud_server/main.py similarity index 86% rename from qccloud_server/main.py rename to chemcloud_server/main.py index a858c4d..ba6b09a 100644 --- a/qccloud_server/main.py +++ b/chemcloud_server/main.py @@ -5,7 +5,7 @@ from fastapi.responses import RedirectResponse from fastapi.staticfiles import StaticFiles -from qccloud_server import __version__ +from chemcloud_server import __version__ from .auth import bearer_auth from .config import get_settings @@ -30,8 +30,8 @@ app = FastAPI( - title="Quantum Chemistry Cloud", - description="⚛ Quantum Chemistry at Cloud Scale ⚛ [Signup here](/signup) or visit your [Dashboard](/users/dashboard)", + title="ChemCloud", + description="⚛ Computational Chemistry at Cloud Scale ⚛ [Signup here](/signup) or visit your [Dashboard](/users/dashboard)", version=__version__, openapi_tags=tags_metadata, ) @@ -58,7 +58,7 @@ async def index(): @app.get("/hello-world", tags=["hello world"]) async def hello_world(name: Optional[str] = None): - return f"Welcome to Quantum Chemistry Cloud, {name or 'friend'}" + return f"Welcome to ChemCloud, {name or 'friend'}" @app.get("/signup", include_in_schema=False) diff --git a/qccloud_server/models.py b/chemcloud_server/models.py similarity index 98% rename from qccloud_server/models.py rename to chemcloud_server/models.py index d9b339d..a7dd06d 100644 --- a/qccloud_server/models.py +++ b/chemcloud_server/models.py @@ -23,8 +23,8 @@ class SupportedEngines(str, Enum): TERACHEM_FE = "terachem_fe" RDKIT = "rdkit" XTB = "xtb" - # BigQC distributed algorithms - BIGQC = "bigqc" + # BigChem distributed algorithms + BIGCHEM = "bigchem" class SupportedProcedures(str, Enum): diff --git a/qccloud_server/routes/__init__.py b/chemcloud_server/routes/__init__.py similarity index 100% rename from qccloud_server/routes/__init__.py rename to chemcloud_server/routes/__init__.py diff --git a/qccloud_server/routes/compute.py b/chemcloud_server/routes/compute.py similarity index 96% rename from qccloud_server/routes/compute.py rename to chemcloud_server/routes/compute.py index ac665c3..942e0a2 100644 --- a/qccloud_server/routes/compute.py +++ b/chemcloud_server/routes/compute.py @@ -3,8 +3,8 @@ from celery.result import AsyncResult from fastapi import APIRouter, BackgroundTasks, HTTPException, Path -from qccloud_server.config import get_settings -from qccloud_server.models import ( +from chemcloud_server.config import get_settings +from chemcloud_server.models import ( AtomicInputOrList, OptimizationInputOrList, Result, diff --git a/qccloud_server/routes/helpers.py b/chemcloud_server/routes/helpers.py similarity index 91% rename from qccloud_server/routes/helpers.py rename to chemcloud_server/routes/helpers.py index 4b75e88..52087fb 100644 --- a/qccloud_server/routes/helpers.py +++ b/chemcloud_server/routes/helpers.py @@ -3,9 +3,9 @@ from typing import Any, Dict, List, Optional, Union import httpx -from bigqc import tasks -from bigqc.algos import parallel_frequency_analysis, parallel_hessian -from bigqc.app import bigqc +from bigchem import tasks +from bigchem.algos import parallel_frequency_analysis, parallel_hessian +from bigchem.app import bigchem from celery.canvas import Signature, group from celery.result import AsyncResult, GroupResult, ResultBase, result_from_tuple from fastapi import HTTPException @@ -19,7 +19,7 @@ ) from tcpb.config import settings as tcpb_settings -from qccloud_server import config, models +from chemcloud_server import config, models settings = config.get_settings() B64_POSTFIX = "_b64" @@ -154,7 +154,7 @@ def restore_result(result_id: str) -> Union[AsyncResult, GroupResult]: ValueError if result not found in backend """ try: - return result_from_tuple(json.loads(bigqc.backend.get(result_id))) + return result_from_tuple(json.loads(bigchem.backend.get(result_id))) except TypeError: raise ValueError(f"Result id '{result_id}', not found.") @@ -190,14 +190,14 @@ def signature_from_input( """Return the celery signature for a compute task NOTE: Must pass enum.value to underlying functions so that celery doesn't try to - deserialize an object containing references to Enums that live in qccloud_server + deserialize an object containing references to Enums that live in chemcloud_server """ - if package == models.SupportedEngines.BIGQC: - bigqc_kwargs = input_data.extras.get(settings.bigqc_keywords, {}) - engine = bigqc_kwargs.pop( + if package == models.SupportedEngines.BIGCHEM: + bigchem_kwargs = input_data.extras.get(settings.bigchem_keywords, {}) + engine = bigchem_kwargs.pop( "gradient_engine", models.SupportedEngines.TERACHEM_FE.value ) - return compute_bigqc(input_data, engine, **bigqc_kwargs) + return compute_bigchem(input_data, engine, **bigchem_kwargs) elif isinstance(input_data, AtomicInput): return tasks.compute.s(input_data, package.value) @@ -205,12 +205,12 @@ def signature_from_input( return tasks.compute_procedure.s(input_data, package.value) -def compute_bigqc( +def compute_bigchem( input_data: AtomicInput, engine: str = models.SupportedEngines.TERACHEM_FE.value, **kwargs, ) -> Signature: - """Top level function for parallelized BigQC algorithms + """Top level function for parallelized BigChem algorithms Use compute_qcc and pass AtomicInput to get back a signature that can be called asynchronously. @@ -218,8 +218,8 @@ def compute_bigqc( Params: input_data: Input specification; driver may be hessian or properties engine: Compute engine to use for gradient calculations. Must pass string rather - than Enum so that BigQC deserialization doesn't try to deserialize an object - containing Enums from qccloud package. + than Enum so that BigChem deserialization doesn't try to deserialize an object + containing Enums from chemcloud package. kwargs: kwargs for parallel_hessian or parallel_frequency_analysis """ diff --git a/qccloud_server/routes/oauth.py b/chemcloud_server/routes/oauth.py similarity index 96% rename from qccloud_server/routes/oauth.py rename to chemcloud_server/routes/oauth.py index a3649c6..eba6bd1 100644 --- a/qccloud_server/routes/oauth.py +++ b/chemcloud_server/routes/oauth.py @@ -4,8 +4,8 @@ from fastapi.param_functions import Form from starlette.responses import RedirectResponse -from qccloud_server import config, models -from qccloud_server.auth import _get_matching_rsa_key, _validate_jwt +from chemcloud_server import config, models +from chemcloud_server.auth import _get_matching_rsa_key, _validate_jwt from .helpers import _auth0_token_request diff --git a/qccloud_server/routes/users.py b/chemcloud_server/routes/users.py similarity index 89% rename from qccloud_server/routes/users.py rename to chemcloud_server/routes/users.py index 1022dbe..1333e9e 100644 --- a/qccloud_server/routes/users.py +++ b/chemcloud_server/routes/users.py @@ -5,8 +5,8 @@ from fastapi.responses import HTMLResponse, RedirectResponse from jose import jwt -from qccloud_server import config -from qccloud_server.auth import _get_matching_rsa_key, _validate_jwt +from chemcloud_server import config +from chemcloud_server.auth import _get_matching_rsa_key, _validate_jwt logger = logging.getLogger(__name__) @@ -45,10 +45,10 @@ async def dashboard( -

✨ You are registered for Quantum Chemistry Cloud! Your username is: {id_payload['email']} ✨

+

✨ You are registered for ChemCloud! Your username is: {id_payload['email']} ✨

diff --git a/docker/context.dev b/docker/context.dev index 0391fea..ea63857 100644 --- a/docker/context.dev +++ b/docker/context.dev @@ -1,6 +1,6 @@ # bash-able variables for docker-compose.web.yaml -WEBSERVER_TRAEFIK_HOST=\`qccloud.dev.mtzlab.com\`,\`tccloud.dev.mtzlab.com\` +WEBSERVER_TRAEFIK_HOST=\`chemcloud.dev.mtzlab.com\`,\`tccloud.dev.mtzlab.com\` MQ_CONSOLE_TRAEFIK_HOST=\`rabbitmq.dev.mtzlab.com\` diff --git a/docker/context.prod b/docker/context.prod index a5547a3..78a6234 100644 --- a/docker/context.prod +++ b/docker/context.prod @@ -1,6 +1,6 @@ # bash-able variables for docker-compose.web.yaml -WEBSERVER_TRAEFIK_HOST=\`qccloud.mtzlab.com\`,\`tccloud.mtzlab.com\` +WEBSERVER_TRAEFIK_HOST=\`chemcloud.mtzlab.com\`,\`tccloud.mtzlab.com\` MQ_CONSOLE_TRAEFIK_HOST=\`rabbitmq.mtzlab.com\` diff --git a/docker/docker-compose.local.yaml b/docker/docker-compose.local.yaml index 875303f..c0d302a 100644 --- a/docker/docker-compose.local.yaml +++ b/docker/docker-compose.local.yaml @@ -9,27 +9,27 @@ services: - 8000:8000 environment: # Connect to rabbit and redis over docker network instead of localhost - - bigqc_broker_url=amqp://mq - - bigqc_backend_url=redis://redis/0 + - bigchem_broker_url=amqp://mq + - bigchem_backend_url=redis://redis/0 env_file: - ../.env volumes: - - ../qccloud_server:/code/qccloud_server - command: uvicorn --host 0.0.0.0 --port 8000 qccloud_server.main:app --reload + - ../chemcloud_server:/code/chemcloud_server + command: uvicorn --host 0.0.0.0 --port 8000 chemcloud_server.main:app --reload worker: - image: coltonbh/bigqc-worker + image: coltonbh/bigchem-worker depends_on: - mq - redis environment: - - bigqc_broker_url=amqp://mq - - bigqc_backend_url=redis://redis/0 + - bigchem_broker_url=amqp://mq + - bigchem_backend_url=redis://redis/0 - TERACHEM_FE_HOST=file-server env_file: - ../.env # Run worker listening to default queue and private_queue - command: celery -A bigqc.tasks worker -Q celery,private_queue --without-heartbeat --without-mingle --without-gossip --loglevel=INFO + command: celery -A bigchem.tasks worker -Q celery,private_queue --without-heartbeat --without-mingle --without-gossip --loglevel=INFO mq: image: rabbitmq:3.8-management-alpine diff --git a/docker/server.dockerfile b/docker/server.dockerfile index 53e2138..5af8078 100644 --- a/docker/server.dockerfile +++ b/docker/server.dockerfile @@ -19,10 +19,10 @@ COPY Pipfile Pipfile.lock ./ # Install to system python, no need for pipenv virtual env RUN pipenv install --system --deploy COPY static ./static -COPY qccloud_server/ ./qccloud_server +COPY chemcloud_server/ ./chemcloud_server EXPOSE 8000 # https://docs.gunicorn.org/en/stable/design.html#how-many-workers # Timeout to 60s for larger results that require more time to collect from redis -CMD ["sh", "-c", "gunicorn qccloud_server.main:app -w 2 -k uvicorn.workers.UvicornWorker --keep-alive 650 --timeout 60 -b 0.0.0.0:8000 --access-logfile -"] +CMD ["sh", "-c", "gunicorn chemcloud_server.main:app -w 2 -k uvicorn.workers.UvicornWorker --keep-alive 650 --timeout 60 -b 0.0.0.0:8000 --access-logfile -"] diff --git a/mypy.ini b/mypy.ini index ec40b54..34b8f5d 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,5 +1,5 @@ [mypy] -files=qccloud_server,tests +files=chemcloud_server,tests plugins=pydantic.mypy ignore_missing_imports=true diff --git a/scripts/example.py b/scripts/example.py index 39f5eb1..20f672d 100644 --- a/scripts/example.py +++ b/scripts/example.py @@ -8,8 +8,8 @@ HOSTS = { "local": "http://localhost:8000", - "dev": "https://qccloud.dev.mtzlab.com", - "prod": "https://qccloud.mtzlab.com", + "dev": "https://chemcloud.dev.mtzlab.com", + "prod": "https://chemcloud.mtzlab.com", } API_PREFIX = "/api/v1" diff --git a/setup.cfg b/setup.cfg index 3f41fe9..e04daf8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,7 +17,7 @@ use_parentheses=True line_length=88 [mypy] -files=qccloud_server,tests +files=chemcloud_server,tests plugins=pydantic.mypy ignore_missing_imports=true diff --git a/tests/conftest.py b/tests/conftest.py index 07b57aa..0cb89d0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,9 +10,9 @@ OptimizationResult, ) -from qccloud_server.auth import bearer_auth -from qccloud_server.config import get_settings -from qccloud_server.main import app +from chemcloud_server.auth import bearer_auth +from chemcloud_server.config import get_settings +from chemcloud_server.main import app @pytest.fixture(scope="session") @@ -28,7 +28,7 @@ def fake_bearer_auth(): return { "iss": "https://dev-mtzlab.us.auth0.com/", "sub": "auth0|5fb8828f1bda000075e14b0a", - "aud": "https://qccloud.dev.mtzlab.com", + "aud": "https://chemcloud.dev.mtzlab.com", "iat": 1606866842, "exp": 1606953242, "azp": "lQvfKdlfxLE0E9mVEIl58Wi9gX2AwWop", # pragma: allowlist secret diff --git a/tests/test_compute.py b/tests/test_compute.py index 6864f08..b3714aa 100644 --- a/tests/test_compute.py +++ b/tests/test_compute.py @@ -258,7 +258,7 @@ def test_compute_procedure_group_limits( @pytest.mark.skip("Long test so skipping for brevity") # Comment out to run test @pytest.mark.parametrize( - "driver,model,bigqc_keywords,group", + "driver,model,bigchem_keywords,group", ( ( "hessian", @@ -287,14 +287,14 @@ def test_compute_procedure_group_limits( ) @pytest.mark.timeout(450) def test_compute_qcc_engine( - settings, client, fake_auth, water, driver, model, bigqc_keywords, group + settings, client, fake_auth, water, driver, model, bigchem_keywords, group ): """Test QC Cloud specific methods""" atomic_input = AtomicInput( molecule=water, driver=driver, model=model, - extras={settings.bigqc_keywords: bigqc_keywords}, + extras={settings.bigchem_keywords: bigchem_keywords}, ) if group: atomic_input = [atomic_input, atomic_input] @@ -303,7 +303,7 @@ def test_compute_qcc_engine( job_submission = client.post( f"{settings.api_v1_str}/compute", data=json_dumps(atomic_input), - params={"engine": "bigqc"}, + params={"engine": "bigchem"}, ) as_dict = job_submission.json() diff --git a/tests/test_helpers.py b/tests/test_helpers.py index fc327a4..cfe527e 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -1,7 +1,7 @@ from qcelemental.models import AtomicResult, OptimizationResult from tcpb.config import settings as tcpb_settings -from qccloud_server.routes.helpers import _b64_to_bytes, _bytes_to_b64 +from chemcloud_server.routes.helpers import _b64_to_bytes, _bytes_to_b64 def test_b64_to_bytes_atomic_input(atomic_input): diff --git a/tests/utils.py b/tests/utils.py index 683cbb1..932ee61 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -4,7 +4,7 @@ import pytest from requests.exceptions import HTTPError -from qccloud_server.models import Result, ResultGroup, TaskState +from chemcloud_server.models import Result, ResultGroup, TaskState def _get_result(client, settings, task_id) -> Union[Result, ResultGroup]: