Skip to main content

dapi simplifies accessing TAPIS on DesignSafe

Project description

DesignSafe API (dapi)

dapi

build and test License Docs

dapi is a library that simplifies the process of submitting, running, and monitoring TAPIS v2 / AgavePy jobs on DesignSafe via Jupyter Notebooks.

Features

Jobs

  • Simplified TAPIS v2 Calls: No need to fiddle with complex API requests. dapi abstracts away the complexities.

  • Seamless Integration with DesignSafe Jupyter Notebooks: Launch DesignSafe applications directly from the Jupyter environment.

Database

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".

Installation

Install dapi via pip

pip3 install dapi

To install the current development version of the library use:

pip install git+https://github.com/DesignSafe-CI/dapi.git --quiet

Example usage:

Jobs

On DesignSafe Jupyter:

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 dapi library
import dapi
  • To list all functions in dapi
dir(dapi)

Database

import dapi

db = dapi.DSDatabase("ngl")
sql = 'SELECT * FROM SITE'
df = db.read_sql(sql)
print(df)

# Optionally, close the database connection when done
db.close()

Documentation

View dapi API doc

To generate API docs:

pdoc --html --output-dir docs dapi --force

Support

For any questions, issues, or feedback submit an issue

Development

To develop or test the library locally. Install Poetry. In the current repository run the following commands

poetry shell
poetry install
poetry build

To run the unit test

poetry run pytest -v

License

dapi is licensed under the MIT License.

Authors

  • Krishna Kumar, University of Texas at Austin
  • Prof. Pedro Arduino, University of Washington
  • Prof. Scott Brandenberg, University of California Los Angeles

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dapi-0.2.0.tar.gz (8.5 kB view hashes)

Uploaded Source

Built Distribution

dapi-0.2.0-py3-none-any.whl (9.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page