Skip to content

Commit

Permalink
Merge 8ac80e4 into ccb3420
Browse files Browse the repository at this point in the history
  • Loading branch information
willrogers committed Nov 20, 2018
2 parents ccb3420 + 8ac80e4 commit 1437bcc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
28 changes: 22 additions & 6 deletions aa/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,28 @@ def _rest_post(self, command, payload, headers, **kwargs):
response = requests.post(url, payload, headers=headers)
return response.json()

def get_all_pvs(self, limit=-1):
# This includes PVs that have connected in the past but are now
# disconnected (those from get_currently_disconnnected_pvs()),
# but not those that have never connected (those from
# get_never_connected_pvs()).
return self._rest_get('getAllPVs', limit=limit)
def get_all_pvs(self, pv=None, limit=-1):
"""Return a list of PVs that are being archived.
This includes PVs that have connected in the past but are now
disconnected (those from get_currently_disconnnected_pvs()),
but not those that have never connected (those from
get_never_connected_pvs()).
Args:
pv: only return PV names that match pv, which may be a glob
limit: return a maximum of limit PV names. The default (-1)
returns all PV names
Returns:
list of PV names
"""
# Only supply the glob argument if it is not None.
kwargs = {'limit': limit}
if pv is not None:
kwargs['pv'] = pv
return self._rest_get('getAllPVs', **kwargs)

def get_pv_type_info(self, pv):
return self._rest_get('getPVTypeInfo', pv=pv)
Expand Down
2 changes: 1 addition & 1 deletion test/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_AaRestClient_construct_url(kwargs, aa_client):


@pytest.mark.parametrize('command,method,kwargs', [
('getAllPVs', 'get_all_pvs', {'limit': -1}),
('getAllPVs', 'get_all_pvs', {'pv': '*', 'limit': -1}),
('getPVTypeInfo', 'get_pv_type_info', {'pv': 'dummy'}),
('getPVStatus', 'get_pv_status', {'pv': 'dummy'}),
('getNeverConnectedPVs', 'get_never_connected_pvs', {}),
Expand Down

0 comments on commit 1437bcc

Please sign in to comment.