|
1 | | -"""Dapi - A Python wrapper for interacting with DesignSafe resources via the Tapis API. |
| 1 | +"""Python client for submitting, monitoring, and managing TAPIS v3 jobs on DesignSafe. |
2 | 2 |
|
3 | | -This package provides a high-level, user-friendly interface for working with DesignSafe |
4 | | -resources through the Tapis V3 API. It simplifies complex operations and provides |
5 | | -organized access to different service areas including authentication, file operations, |
6 | | -job submission and monitoring, application discovery, system information, and database access. |
| 3 | +Also provides access to DesignSafe research databases (NGL, Earthquake Recovery, VP) |
| 4 | +and file operations (path translation, upload, download). |
7 | 5 |
|
8 | | -Key Features: |
9 | | - - Simplified authentication with credential resolution hierarchy |
10 | | - - DesignSafe path translation (MyData, projects, etc.) to Tapis URIs |
11 | | - - High-level job submission with automatic app parameter mapping |
12 | | - - Job monitoring with progress bars and status interpretation |
13 | | - - File upload/download with automatic directory creation |
14 | | - - Application discovery and detailed retrieval |
15 | | - - System queue information and resource limits |
16 | | - - Database access for DesignSafe research databases |
17 | | - - Comprehensive error handling with descriptive exceptions |
| 6 | +Classes: |
| 7 | + DSClient: Entry point. Provides access to jobs, files, apps, systems, and databases. |
| 8 | + SubmittedJob: Returned by ``DSClient.jobs.submit()``. Used to monitor and inspect a job. |
18 | 9 |
|
19 | | -Main Components: |
20 | | - DSClient: Main client class providing organized access to all services |
21 | | - SubmittedJob: Class for managing and monitoring submitted Tapis jobs |
22 | | - Exception classes: Specific exceptions for different error types |
| 10 | +Example:: |
23 | 11 |
|
24 | | -Example: |
25 | | - Basic usage with automatic authentication: |
| 12 | + from dapi import DSClient |
26 | 13 |
|
27 | | - >>> from dapi import DSClient |
28 | | - >>> client = DSClient() |
29 | | - Enter DesignSafe Username: myuser |
30 | | - Enter DesignSafe Password: [hidden] |
31 | | - Authentication successful. |
| 14 | + client = DSClient() |
| 15 | + job_request = client.jobs.generate( |
| 16 | + app_id="matlab-r2023a", |
| 17 | + input_dir_uri="/MyData/analysis/input/", |
| 18 | + script_filename="run_analysis.m", |
| 19 | + ) |
| 20 | + job = client.jobs.submit(job_request) |
| 21 | + final_status = job.monitor() |
32 | 22 |
|
33 | | - >>> # File operations |
34 | | - >>> client.files.upload("/local/file.txt", "/MyData/uploads/file.txt") |
35 | | - >>> files = client.files.list("/MyData/uploads/") |
36 | | -
|
37 | | - >>> # Job submission and monitoring |
38 | | - >>> job_request = client.jobs.generate( |
39 | | - ... app_id="matlab-r2023a", |
40 | | - ... input_dir_uri="/MyData/analysis/input/", |
41 | | - ... script_filename="run_analysis.m", |
42 | | - ... ) |
43 | | - >>> job = client.jobs.submit(job_request) |
44 | | - >>> final_status = job.monitor() |
45 | | -
|
46 | | - >>> # Database access |
47 | | - >>> df = client.db.ngl.read_sql("SELECT * FROM earthquake_data LIMIT 10") |
48 | | -
|
49 | | -Attributes: |
50 | | - __version__ (str): The version number of the dapi package. |
51 | | - DSClient: Main client class for DesignSafe API interactions. |
52 | | - SubmittedJob: Class for managing submitted Tapis jobs. |
53 | | - Exception classes: Custom exceptions for specific error conditions. |
| 23 | + df = client.db.ngl.read_sql("SELECT * FROM SITE LIMIT 10") |
54 | 24 | """ |
55 | 25 |
|
56 | 26 | from .client import DSClient |
|
0 commit comments