Skip to content

Commit be8f31f

Browse files
authored
Merge pull request #530 from ssl-hep/remote_url_option
Eliminate unnecessary URL options from the command line.
2 parents b969ab3 + 142cc50 commit be8f31f

File tree

5 files changed

+13
-25
lines changed

5 files changed

+13
-25
lines changed

docs/command_line.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ Common command line arguments:
1313
| F | Long | What it does |
1414
| lag | Flag | |
1515
+=====+==========+=====================================================+
16-
| -u | –url | The url of the serviceX ingress |
17-
+-----+----------+-----------------------------------------------------+
1816
| -b | –backend | Named backend from the .servicex file endpoints |
1917
| | | list |
2018
+-----+----------+-----------------------------------------------------+
2119

22-
If neither url nor backend are specified then the client will attempt to
20+
If no backend is specified then the client will attempt to
2321
use the ``default_endpoint`` value to determine who to talk to.
2422

2523
codegens

servicex/app/cli_options.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import typer
2929

3030

31-
url_cli_option = typer.Option(None, "-u", "--url", help="URL of ServiceX server")
3231
backend_cli_option = typer.Option(None, "-b", "--backend",
3332
help="Name of backend server from .servicex file")
3433
config_file_option = typer.Option(None, "-c", "--config",

servicex/app/codegen.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import rich
3030
import typer
3131

32-
from servicex.app.cli_options import url_cli_option, backend_cli_option, config_file_option
32+
from servicex.app.cli_options import backend_cli_option, config_file_option
3333
from servicex.servicex_client import ServiceXClient
3434
from typing import Optional
3535

@@ -38,25 +38,23 @@
3838

3939
@codegen_app.command(no_args_is_help=False)
4040
def flush(
41-
url: Optional[str] = url_cli_option,
4241
backend: Optional[str] = backend_cli_option,
4342
config_path: Optional[str] = config_file_option):
4443
"""
4544
Flush the available code generators from the cache
4645
"""
47-
sx = ServiceXClient(url=url, backend=backend, config_path=config_path)
46+
sx = ServiceXClient(backend=backend, config_path=config_path)
4847
cache = sx.query_cache
4948
cache.delete_codegen_by_backend(backend)
5049
rich.print("Deleted cached code generators.")
5150

5251

5352
@codegen_app.command(no_args_is_help=False)
5453
def list(
55-
url: Optional[str] = url_cli_option,
5654
backend: Optional[str] = backend_cli_option,
5755
config_path: Optional[str] = config_file_option):
5856
"""
5957
List the available code generators
6058
"""
61-
sx = ServiceXClient(url=url, backend=backend, config_path=config_path)
59+
sx = ServiceXClient(backend=backend, config_path=config_path)
6260
rich.print_json(data=sx.get_code_generators())

servicex/app/datasets.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
import rich
3232

33-
from servicex.app.cli_options import url_cli_option, backend_cli_option
33+
from servicex.app.cli_options import backend_cli_option
3434

3535
import typer
3636

@@ -42,7 +42,6 @@
4242

4343
@datasets_app.command(no_args_is_help=True)
4444
def list(
45-
url: Optional[str] = url_cli_option,
4645
backend: Optional[str] = backend_cli_option,
4746
did_finder: Optional[str] = typer.Option(
4847
None,
@@ -58,7 +57,7 @@ def list(
5857
"""
5958
List the datasets.
6059
"""
61-
sx = ServiceXClient(url=url, backend=backend)
60+
sx = ServiceXClient(backend=backend)
6261
table = Table(title="ServiceX Datasets")
6362
table.add_column("ID")
6463
table.add_column("Name")
@@ -90,11 +89,10 @@ def list(
9089

9190
@datasets_app.command(no_args_is_help=True)
9291
def get(
93-
url: Optional[str] = url_cli_option,
9492
backend: Optional[str] = backend_cli_option,
9593
dataset_id: int = typer.Argument(..., help="The ID of the dataset to get")
9694
):
97-
sx = ServiceXClient(url=url, backend=backend)
95+
sx = ServiceXClient(backend=backend)
9896
table = Table(title=f"Dataset ID {dataset_id}")
9997
table.add_column("Paths")
10098
dataset = asyncio.run(sx.get_dataset(dataset_id))
@@ -114,11 +112,10 @@ def get(
114112

115113
@datasets_app.command(no_args_is_help=True)
116114
def delete(
117-
url: Optional[str] = url_cli_option,
118115
backend: Optional[str] = backend_cli_option,
119116
dataset_id: int = typer.Argument(..., help="The ID of the dataset to delete")
120117
):
121-
sx = ServiceXClient(url=url, backend=backend)
118+
sx = ServiceXClient(backend=backend)
122119
result = asyncio.run(sx.delete_dataset(dataset_id))
123120
if result:
124121
typer.echo(f"Dataset {dataset_id} deleted")

servicex/app/transforms.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from rich.progress import Progress
3838
from rich.table import Table
3939

40-
from servicex.app.cli_options import url_cli_option, backend_cli_option
40+
from servicex.app.cli_options import backend_cli_option
4141
from servicex.minio_adapter import MinioAdapter
4242
from servicex.models import Status, ResultFile
4343
from servicex.servicex_client import ServiceXClient
@@ -55,7 +55,6 @@ def transforms():
5555

5656
@transforms_app.command(no_args_is_help=True)
5757
def list(
58-
url: Optional[str] = url_cli_option,
5958
backend: Optional[str] = backend_cli_option,
6059
complete: Optional[bool] = typer.Option(
6160
None, "--complete", help="Only show successfully completed transforms"
@@ -64,7 +63,7 @@ def list(
6463
"""
6564
List the transforms that have been run.
6665
"""
67-
sx = ServiceXClient(url=url, backend=backend)
66+
sx = ServiceXClient(backend=backend)
6867
table = Table(title="ServiceX Transforms")
6968
table.add_column("Transform ID")
7069
table.add_column("Title")
@@ -82,7 +81,6 @@ def list(
8281

8382
@transforms_app.command(no_args_is_help=True)
8483
def files(
85-
url: Optional[str] = url_cli_option,
8684
backend: Optional[str] = backend_cli_option,
8785
transform_id: str = typer.Option(None, "-t", "--transform-id", help="Transform ID"),
8886
):
@@ -94,7 +92,7 @@ async def list_files(sx: ServiceXClient, transform_id: str) -> List[ResultFile]:
9492
minio = MinioAdapter.for_transform(transform)
9593
return await minio.list_bucket()
9694

97-
sx = ServiceXClient(url=url, backend=backend)
95+
sx = ServiceXClient(backend=backend)
9896
result_files = asyncio.run(list_files(sx, transform_id))
9997
table = rich.table.Table(title=f"Files from {transform_id}")
10098
table.add_column("filename")
@@ -107,7 +105,6 @@ async def list_files(sx: ServiceXClient, transform_id: str) -> List[ResultFile]:
107105

108106
@transforms_app.command(no_args_is_help=True)
109107
def download(
110-
url: Optional[str] = url_cli_option,
111108
backend: Optional[str] = backend_cli_option,
112109
transform_id: str = typer.Option(None, "-t", "--transform-id", help="Transform ID"),
113110
local_dir: str = typer.Option(".", "-d", help="Local dir to download to"),
@@ -136,7 +133,7 @@ async def download_with_progress(filename) -> Path:
136133

137134
with Progress() as progress:
138135
download_progress = progress.add_task("Downloading", start=False, total=None)
139-
sx = ServiceXClient(url=url, backend=backend)
136+
sx = ServiceXClient(backend=backend)
140137
result_files = asyncio.run(download_files(sx, transform_id, local_dir))
141138

142139
for path in result_files:
@@ -200,7 +197,6 @@ def create_kibana_link_parameters(log_url, transform_id=None, log_level=None, ti
200197

201198
@transforms_app.command(no_args_is_help=True)
202199
def logs(
203-
url: Optional[str] = url_cli_option,
204200
backend: Optional[str] = backend_cli_option,
205201
transform_id: str = typer.Option(None, "-t", "--transform-id", help="Transform ID"),
206202
log_level: Optional[LogLevel] = typer.Option("ERROR", "-l", "--log-level",
@@ -213,7 +209,7 @@ def logs(
213209
"""
214210
Open the URL to the Kibana dashboard of the logs of a tranformer
215211
"""
216-
sx = ServiceXClient(backend=backend, url=url)
212+
sx = ServiceXClient(backend=backend)
217213
transforms = sx.get_transform_status(transform_id)
218214
if transforms and transforms.request_id == transform_id:
219215
kibana_link = create_kibana_link_parameters(transforms.log_url,

0 commit comments

Comments
 (0)