Skip to content

Commit ea399b8

Browse files
committed
Rename commands for brevity
1 parent bcfdca4 commit ea399b8

13 files changed

Lines changed: 87 additions & 359 deletions

File tree

dapi/client.py

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,9 @@ def __init__(self, tapis_client: Tapis):
169169
"""
170170
self._tapis = tapis_client
171171

172-
def translate_path_to_uri(self, *args, **kwargs) -> str:
172+
def to_uri(self, *args, **kwargs) -> str:
173173
"""Translate DesignSafe-style paths to Tapis URIs.
174174
175-
This is a convenience wrapper around files_module.get_ds_path_uri().
176-
177175
Args:
178176
*args: Positional arguments passed to get_ds_path_uri().
179177
**kwargs: Keyword arguments passed to get_ds_path_uri().
@@ -187,11 +185,9 @@ def translate_path_to_uri(self, *args, **kwargs) -> str:
187185
"""
188186
return files_module.get_ds_path_uri(self._tapis, *args, **kwargs)
189187

190-
def translate_uri_to_path(self, *args, **kwargs) -> str:
188+
def to_path(self, *args, **kwargs) -> str:
191189
"""Translate Tapis URIs to DesignSafe local paths.
192190
193-
This is a convenience wrapper around files_module.tapis_uri_to_local_path().
194-
195191
Args:
196192
*args: Positional arguments passed to tapis_uri_to_local_path().
197193
**kwargs: Keyword arguments passed to tapis_uri_to_local_path().
@@ -200,7 +196,7 @@ def translate_uri_to_path(self, *args, **kwargs) -> str:
200196
str: The corresponding DesignSafe local path (e.g., /home/jupyter/MyData/path).
201197
202198
Example:
203-
>>> local_path = ds.files.translate_uri_to_path("tapis://designsafe.storage.default/user/data")
199+
>>> local_path = ds.files.to_path("tapis://designsafe.storage.default/user/data")
204200
>>> print(local_path) # "/home/jupyter/MyData/data"
205201
"""
206202
return files_module.tapis_uri_to_local_path(*args, **kwargs)
@@ -270,7 +266,7 @@ def __init__(self, tapis_client: Tapis):
270266
"""
271267
self._tapis = tapis_client
272268

273-
def list_queues(self, system_id: str, verbose: bool = True) -> List[Any]:
269+
def queues(self, system_id: str, verbose: bool = True) -> List[Any]:
274270
"""List logical queues available on a Tapis execution system.
275271
276272
This is a convenience wrapper around systems_module.list_system_queues().
@@ -379,7 +375,7 @@ def __init__(self, tapis_client):
379375

380376
def generate(
381377
self,
382-
base_command: str,
378+
command: str,
383379
sweep: Dict[str, Any],
384380
directory: str = None,
385381
*,
@@ -392,12 +388,12 @@ def generate(
392388
With ``preview=True``, returns a DataFrame of all parameter
393389
combinations — no files are written.
394390
395-
Otherwise, expands *base_command* into one command per combination
391+
Otherwise, expands *command* into one command per combination
396392
and writes ``runsList.txt`` and ``call_pylauncher.py`` into
397393
*directory*. Returns the list of generated commands.
398394
399395
Args:
400-
base_command: Command template with placeholders matching sweep keys.
396+
command: Command template with placeholders matching sweep keys.
401397
sweep: Mapping of placeholder name to sequence of values.
402398
directory: Directory to write files into (created if needed).
403399
Required when *preview* is ``False``.
@@ -411,7 +407,7 @@ def generate(
411407
*preview* is ``True``.
412408
"""
413409
return launcher_module.generate_sweep(
414-
base_command, sweep, directory,
410+
command, sweep, directory,
415411
placeholder_style=placeholder_style, debug=debug, preview=preview,
416412
)
417413

@@ -617,23 +613,22 @@ def submit(self, job_request: Dict[str, Any]) -> SubmittedJob:
617613
"""
618614
return jobs_module.submit_job_request(self._tapis, job_request)
619615

620-
# --- Management methods remain the same ---
621-
def get(self, job_uuid: str) -> SubmittedJob:
622-
"""Get a SubmittedJob object for managing an existing job by UUID.
616+
def job(self, job_uuid: str) -> SubmittedJob:
617+
"""Get a SubmittedJob object for an existing job by UUID.
623618
624619
Args:
625620
job_uuid (str): The UUID of an existing Tapis job.
626621
627622
Returns:
628-
SubmittedJob: A SubmittedJob object for monitoring and managing the job.
623+
SubmittedJob: A job object for monitoring via ``.monitor()``.
629624
630625
Example:
631-
>>> job = ds.jobs.get("12345678-1234-1234-1234-123456789abc")
632-
>>> status = job.status
626+
>>> job = ds.jobs.job("12345678-1234-1234-1234-123456789abc")
627+
>>> job.monitor()
633628
"""
634629
return SubmittedJob(self._tapis, job_uuid)
635630

636-
def get_status(self, job_uuid: str) -> str:
631+
def status(self, job_uuid: str) -> str:
637632
"""Get the current status of a job by UUID.
638633
639634
Args:
@@ -646,12 +641,12 @@ def get_status(self, job_uuid: str) -> str:
646641
JobMonitorError: If status retrieval fails.
647642
648643
Example:
649-
>>> status = ds.jobs.get_status("12345678-1234-1234-1234-123456789abc")
650-
>>> print(f"Job status: {status}")
644+
>>> ds.jobs.status("12345678-1234-1234-1234-123456789abc")
645+
'FINISHED'
651646
"""
652647
return jobs_module.get_job_status(self._tapis, job_uuid)
653648

654-
def get_runtime_summary(self, job_uuid: str, verbose: bool = False):
649+
def runtime_summary(self, job_uuid: str, verbose: bool = False):
655650
"""Print the runtime summary for a job by UUID.
656651
657652
Args:
@@ -660,7 +655,7 @@ def get_runtime_summary(self, job_uuid: str, verbose: bool = False):
660655
Defaults to False.
661656
662657
Example:
663-
>>> ds.jobs.get_runtime_summary("12345678-1234-1234-1234-123456789abc")
658+
>>> ds.jobs.runtime_summary("12345678-1234-1234-1234-123456789abc")
664659
Runtime Summary
665660
---------------
666661
QUEUED time: 00:05:30

dapi/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class SystemInfoError(DapiException):
109109
110110
Example:
111111
>>> try:
112-
... queues = client.systems.list_queues("nonexistent-system")
112+
... queues = client.systems.queues("nonexistent-system")
113113
... except SystemInfoError as e:
114114
... print(f"System info retrieval failed: {e}")
115115
"""

dapi/launcher.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ def _validate_sweep(sweep: Mapping[str, Sequence[Any]]) -> None:
2727

2828

2929
def _expand_commands(
30-
base_command: str,
30+
command: str,
3131
sweep: Mapping[str, Sequence[Any]],
3232
placeholder_style: str,
3333
) -> List[str]:
3434
"""Expand a command template into all parameter combinations."""
3535
if not sweep:
36-
return [base_command]
36+
return [command]
3737

3838
_validate_sweep(sweep)
3939

@@ -43,7 +43,7 @@ def _expand_commands(
4343
keys = list(sweep.keys())
4444
commands: List[str] = []
4545
for combo in product(*[sweep[k] for k in keys]):
46-
cmd = base_command
46+
cmd = command
4747
for k, v in zip(keys, combo):
4848
if placeholder_style == "token":
4949
cmd = cmd.replace(k, str(v))
@@ -55,7 +55,7 @@ def _expand_commands(
5555

5656

5757
def generate_sweep(
58-
base_command: str,
58+
command: str,
5959
sweep: Mapping[str, Sequence[Any]],
6060
directory: Union[str, Path, None] = None,
6161
*,
@@ -69,19 +69,19 @@ def generate_sweep(
6969
combinations without writing any files — useful for inspecting the
7070
sweep in a notebook before committing.
7171
72-
When *preview* is ``False`` (default), expands *base_command* into one
72+
When *preview* is ``False`` (default), expands *command* into one
7373
command per parameter combination and writes ``runsList.txt`` and
7474
``call_pylauncher.py`` into *directory*.
7575
7676
Args:
77-
base_command: Command template containing placeholders that match
77+
command: Command template containing placeholders that match
7878
keys in *sweep*. Environment variables like ``$WORK`` or
7979
``$SLURM_JOB_ID`` are left untouched.
8080
sweep: Mapping of placeholder name to a sequence of values.
8181
Example: ``{"ALPHA": [0.3, 0.5], "BETA": [1, 2]}``.
8282
directory: Directory to write files into. Created if it doesn't
8383
exist. Required when *preview* is ``False``.
84-
placeholder_style: How placeholders appear in *base_command*:
84+
placeholder_style: How placeholders appear in *command*:
8585
8686
- ``"token"`` (default): bare tokens, e.g. ``ALPHA``
8787
- ``"braces"``: brace-wrapped, e.g. ``{ALPHA}``
@@ -113,7 +113,7 @@ def generate_sweep(
113113
if directory is None:
114114
raise ValueError("directory is required when preview=False.")
115115

116-
commands = _expand_commands(base_command, sweep, placeholder_style)
116+
commands = _expand_commands(command, sweep, placeholder_style)
117117

118118
dirpath = Path(directory)
119119
dirpath.mkdir(parents=True, exist_ok=True)

docs/examples/mpm.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ mpm_config = {
8888

8989
```python
9090
# Convert DesignSafe path to Tapis URI format
91-
input_uri = ds.files.translate_path_to_uri(ds_path)
91+
input_uri = ds.files.to_uri(ds_path)
9292
print(f"Input Directory Tapis URI: {input_uri}")
9393
```
9494

@@ -232,7 +232,7 @@ ds.jobs.interpret_status(final_status, submitted_job.uuid)
232232
submitted_job.print_runtime_summary(verbose=False)
233233

234234
# Get current job status
235-
current_status = ds.jobs.get_status(submitted_job.uuid)
235+
current_status = ds.jobs.status(submitted_job.uuid)
236236
print(f"Current status: {current_status}")
237237

238238
# Display last status message from TACC
@@ -243,7 +243,7 @@ print(f"Last message: {submitted_job.last_message}")
243243

244244
- **`interpret_status`**: Provides human-readable explanation of job outcome
245245
- **`print_runtime_summary`**: Shows time spent in each job phase (queued, running, etc.)
246-
- **`get_status`**: Gets current job status (useful for checking later)
246+
- **`status`**: Gets current job status (useful for checking later)
247247
- **`last_message`**: Shows last status message from the job scheduler
248248

249249
### Step 10: View Job Output
@@ -307,7 +307,7 @@ typical_outputs = {
307307

308308
```python
309309
# Convert archive URI to local path for analysis
310-
archive_path = ds.files.translate_uri_to_path(archive_uri)
310+
archive_path = ds.files.to_path(archive_uri)
311311
print(f"Archive path: {archive_path}")
312312

313313
# Import analysis libraries
@@ -333,7 +333,7 @@ else:
333333

334334
**What this does:**
335335

336-
- **`translate_uri_to_path`**: Converts Tapis URI to local file system path
336+
- **`to_path`**: Converts Tapis URI to local file system path
337337
- **`os.listdir`**: Lists files in the results directory
338338
- **`.vtu files`**: VTK unstructured grid files for visualization
339339
- **ParaView**: Recommended tool for visualizing MPM particle data

docs/examples/openfoam.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ solvers = {
9090

9191
```python
9292
# Convert DesignSafe path to Tapis URI format
93-
input_uri = ds.files.translate_path_to_uri(ds_path)
93+
input_uri = ds.files.to_uri(ds_path)
9494
print(f"Input Directory Tapis URI: {input_uri}")
9595
```
9696

@@ -239,7 +239,7 @@ ds.jobs.interpret_status(final_status, submitted_job.uuid)
239239
submitted_job.print_runtime_summary(verbose=False)
240240

241241
# Get current job status
242-
current_status = ds.jobs.get_status(submitted_job.uuid)
242+
current_status = ds.jobs.status(submitted_job.uuid)
243243
print(f"Current status: {current_status}")
244244

245245
# Display last status message from TACC
@@ -250,7 +250,7 @@ print(f"Last message: {submitted_job.last_message}")
250250

251251
- **`interpret_status`**: Provides human-readable explanation of job outcome
252252
- **`print_runtime_summary`**: Shows time spent in each job phase (queued, running, etc.)
253-
- **`get_status`**: Gets current job status (useful for checking later)
253+
- **`status`**: Gets current job status (useful for checking later)
254254
- **`last_message`**: Shows last status message from the job scheduler
255255

256256
### Step 10: View Job Output
@@ -302,7 +302,7 @@ typical_outputs = {
302302

303303
```python
304304
# Convert archive URI to local path for analysis
305-
archive_path = ds.files.translate_uri_to_path(archive_uri)
305+
archive_path = ds.files.to_path(archive_uri)
306306
print(f"Archive path: {archive_path}")
307307

308308
# Import plotting libraries
@@ -322,7 +322,7 @@ print(f"Loaded force coefficients data with shape: {data.shape}")
322322

323323
**What this does:**
324324

325-
- **`translate_uri_to_path`**: Converts Tapis URI to local file system path
325+
- **`to_path`**: Converts Tapis URI to local file system path
326326
- **`pandas.read_csv`**: Reads force coefficient data (much cleaner than manual parsing)
327327
- **`skiprows=9`**: Skips OpenFOAM header lines
328328
- **`sep='\t'`**: Uses tab separator (OpenFOAM default)

docs/examples/opensees.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ control_corespernode: int = 16 # Cores per node for parallel analysis
8080

8181
```python
8282
# Convert DesignSafe path to Tapis URI format
83-
input_uri = ds.files.translate_path_to_uri(ds_path)
83+
input_uri = ds.files.to_uri(ds_path)
8484
print(f"Input Directory Tapis URI: {input_uri}")
8585
```
8686

@@ -225,7 +225,7 @@ ds.jobs.interpret_status(final_status, submitted_job.uuid)
225225
submitted_job.print_runtime_summary(verbose=False)
226226

227227
# Get current job status
228-
current_status = ds.jobs.get_status(submitted_job.uuid)
228+
current_status = ds.jobs.status(submitted_job.uuid)
229229
print(f"Current status: {current_status}")
230230

231231
# Display last status message from TACC
@@ -236,7 +236,7 @@ print(f"Last message: {submitted_job.last_message}")
236236

237237
- **`interpret_status`**: Provides human-readable explanation of job outcome
238238
- **`print_runtime_summary`**: Shows time spent in each job phase (queued, running, etc.)
239-
- **`get_status`**: Gets current job status (useful for checking later)
239+
- **`status`**: Gets current job status (useful for checking later)
240240
- **`last_message`**: Shows last status message from the job scheduler
241241

242242
### Step 10: Access Job Archive and Results
@@ -247,7 +247,7 @@ archive_uri = submitted_job.archive_uri
247247
print(f"Archive URI: {archive_uri}")
248248

249249
# Translate archive URI to local DesignSafe path
250-
local_archive_path = ds.files.translate_uri_to_path(archive_uri)
250+
local_archive_path = ds.files.to_path(archive_uri)
251251
print(f"Local archive path: {local_archive_path}")
252252

253253
# List archive contents
@@ -260,7 +260,7 @@ for item in archive_files:
260260
**What this does:**
261261

262262
- **`archive_uri`**: Location where job results are stored
263-
- **`translate_uri_to_path`**: Converts Tapis URI to local path for analysis
263+
- **`to_path`**: Converts Tapis URI to local path for analysis
264264
- **`ds.files.list`**: Lists all files and directories in the archive
265265
- Shows output files like analysis results, output data, and logs
266266

@@ -290,7 +290,7 @@ try:
290290
print(f"- {item.name} ({item.type})")
291291

292292
# Change to the archive directory for post-processing
293-
archive_path = ds.files.translate_uri_to_path(input_dir_archive_uri)
293+
archive_path = ds.files.to_path(input_dir_archive_uri)
294294
os.chdir(archive_path)
295295
print(f"\nChanged to directory: {archive_path}")
296296

docs/jobs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ print(f"Default Cores: {app_details.jobAttributes.coresPerNode}")
108108
```python
109109
# 1. Prepare input directory
110110
input_path = "/MyData/analysis/input/"
111-
input_uri = ds.files.translate_path_to_uri(input_path, verify_exists=True)
111+
input_uri = ds.files.to_uri(input_path, verify_exists=True)
112112

113113
# 2. Generate job request
114114
job_request = ds.jobs.generate(
@@ -403,7 +403,7 @@ for job in jobs:
403403

404404
```python
405405
# List available queues for a system
406-
frontera_queues = ds.systems.list_queues("frontera")
406+
frontera_queues = ds.systems.queues("frontera")
407407
for queue in frontera_queues:
408408
print(f"Queue: {queue.name}")
409409
print(f"Max runtime: {queue.maxRequestedTime} minutes")
@@ -419,7 +419,7 @@ print(f"Development queue available: {dev_queue_exists}")
419419
```python
420420
# Get system information
421421
try:
422-
queues = ds.systems.list_queues("stampede3")
422+
queues = ds.systems.queues("stampede3")
423423
print(f"Stampede3 has {len(queues)} available queues")
424424
except Exception as e:
425425
print(f"Cannot access Stampede3: {e}")

0 commit comments

Comments
 (0)