dapi is a library that simplifies the process of submitting, running, and monitoring TAPIS v3 jobs on DesignSafe via Jupyter Notebooks.
-
Get TAPIS v3 templates for jobs: No need to fiddle with complex API requests.
dapiabstracts away the complexities. -
Seamless Integration with DesignSafe Jupyter Notebooks: Launch DesignSafe applications directly from the Jupyter environment.
Connects to SQL databases on DesignSafe:
| Database | dbname | env_prefix |
|---|---|---|
| NGL | ngl |
NGL_ |
| Earthake Recovery | eq |
EQ_ |
| Vp | vp |
VP_ |
Define the following environment variables:
{env_prefix}DB_USER
{env_prefix}DB_PASSWORD
{env_prefix}DB_HOST
{env_prefix}DB_PORT
For e.g., to add the environment variable NGL_DB_USER edit ~/.bashrc, ~/.zshrc, or a similar shell-specific configuration file for the current user and add export NGL_DB_USER="dspublic".
Install dapi via pip
pip3 install dapiTo install the current development version of the library use:
pip install git+https://github.com/DesignSafe-CI/dapi.git --quietDapi uses the Tapis v3 SDK to authenticate with the DesignSafe API. To store your credentials, create a .env file in the root of your project with the following content:
DESIGNSAFE_USERNAME=<your_designsafe_username>
DESIGNSAFE_PASSWORD=<your_designsafe_password>-
Jupyter Notebook Templates using dapi.
-
View dapi API doc
Install the latest version of dapi and restart the kernel (Kernel >> Restart Kernel):
# Remove any previous installations
!pip uninstall dapi -y
# Install
!pip install dapi --quiet- Import
dapilibrary
import dapi- To list all functions in
dapi
dir(dapi)from dapi.db import DSDatabase
db = DSDatabase("ngl")
sql = 'SELECT * FROM SITE'
df = db.read_sql(sql)
print(df)
# Optionally, close the database connection when done
db.close()For any questions, issues, or feedback submit an issue
To develop or test the library locally. Install Poetry. In the current repository run the following commands
poetry shell
poetry install
poetry buildTo run the unit test
poetry run pytest -vdapi is licensed under the MIT License.
- Krishna Kumar, University of Texas at Austin
- Prof. Pedro Arduino, University of Washington
- Prof. Scott Brandenberg, University of California Los Angeles
View dapi API doc
To serve the MkDocs documentation locally:
poetry install
poetry run mkdocs serveThis will start a local server at http://127.0.0.1:8000/dapi/ where you can view the documentation.
