Skip to content

Commit 5c657ae

Browse files
authored
Clean up: small improvements (#120)
Small improvements - better error messages, improve the read me.
1 parent 26104d9 commit 5c657ae

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,17 @@ The selection string is often generated by another front-end library, for exampl
2222
Before you can use this library you'll need:
2323

2424
- An environment based on python 3.6 or later
25-
- A `ServiceX` end-point. For example, `http://localhost:5000/servicex`, if `ServiceX` is running on a local `k8` cluster and the proper ports are open, or the public servicex instance (contact IRIS-HEP at xxx if you are part of the LHC to request an account, or with help setting up an instance).
25+
- A `ServiceX` end-point. This is usually gotten by logging into and getting approved at the servicex endpoint. Once you do that, you'll have an API token, which this library needs to access the `ServiceX` endpoint, and the web address where you got that token (the `endpoint` address).
2626

2727
### How to access your endpoint
2828

29-
The `servicex` library searches for configuration information in several locations to determine what end-point it should connect to, in the following order:
29+
The API access information is normally placed in a `.servicex` file (to keep this confidential information form accidentally getting checked into a public repository). The `servicex` library searches for configuration information in several locations to determine what end-point it should connect to, in the following order:
3030

3131
1. A `.servicex` file in the current working directory
3232
1. A `.servicex` file in the user's home directory (`$HOME` on Linux and Mac, and your profile
3333
directory on Windows).
3434
1. The `config_defaults.yaml` file distributed with the `servicex` package.
3535

36-
If no endpoint is specified, then the library defaults to the developer endpoint, which is `http://localhost:5000` for the web-service API, and `localhost:9000` for the `minio` endpoint. No passwords are required.
37-
3836
Create a `.servicex` file, in the `yaml` format, in the appropriate place for your work that contains the following:
3937

4038
```yaml
@@ -56,7 +54,7 @@ Finally, you can create the objects `ServiceXAdaptor` and `MinioAdaptor` by hand
5654
The following lines will return a `pandas.DataFrame` containing all the jet pT's from an ATLAS xAOD file containing Z->ee Monte Carlo:
5755

5856
```python
59-
from servicex import ServiceX
57+
from servicex import ServiceXDataset
6058
query = "(call ResultTTree (call Select (call SelectMany (call EventDataset (list 'localds:bogus')) (lambda (list e) (call (attr e 'Jets') 'AntiKt4EMTopoJets'))) (lambda (list j) (/ (call (attr j 'pt')) 1000.0))) (list 'JetPt') 'analysis' 'junk.root')"
6159
dataset = "mc15_13TeV:mc15_13TeV.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.merge.DAOD_STDM3.e3601_s2576_s2132_r6630_r6264_p2363_tid05630052_00"
6260
ds = ServiceXDataset(dataset)
@@ -138,6 +136,10 @@ This code has been tested in several environments:
138136
- Python 3.6, 3.7, 3.8
139137
- Jupyter Notebooks (not automated), regular python command-line invoked source files
140138

139+
### Non-standard backends
140+
141+
When doing backend development, often ports 9000 and 5000 are forwarded to the local machine exposing the `minio` and `ServiceX_App` instances. In that case, you'll need to create a `.servicex` file that has `http://localhost:5000` as the end point. No API token is necessary if the development `ServiceX` instance doesn't have authorization turned on.
142+
141143
## API
142144

143145
Everything is based around the `ServiceXDataset` object. Below is the documentation for the most common parameters.

servicex/servicex.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,9 @@ async def _get_files(self, selection_query: str, data_type: str,
270270

271271
except ServiceXUnknownRequestID as e:
272272
self._cache.remove_query(query)
273-
raise ServiceXException('ServiceX instance does not know about cached query '
274-
f'{request_id}. Please resubmit.') from e
273+
raise ServiceXException('Expected the ServiceX backend to know about query '
274+
f'{request_id}. It did not. Cleared local cache. '
275+
'Please resubmit to trigger a new query.') from e
275276

276277
except ServiceXFatalTransformException as e:
277278
transform_status = await self._servicex_adaptor.get_query_status(client,

servicex/servicex_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ def extract_info(ep) -> Tuple[str, Optional[str], Optional[str]]:
132132
seen_types = [str(ep['type'].as_str_expanded()) for ep in endpoints
133133
if ep['type'].exists()]
134134
raise ServiceXException(f'Unable to find type {backend_type} '
135-
f'in configuration. Saw: {", ".join(seen_types)}')
135+
'in .servicex configuration file. Saw only types'
136+
f': {", ".join(seen_types)}')
136137

137138
# Nope - now we are going to have to just use the first one there.
138139
for ep in endpoints:

0 commit comments

Comments
 (0)