Commit 48e2ea99 authored by Drew Devereux's avatar Drew Devereux
Browse files

Merge branch 'at6-759-subarray-resource' into 'master'

AT6-759 allow changing the subarray resourcing JSON key

See merge request ska-telescope/ska-tango-base!47
parents a44a56d0 b67a4858
release=0.10.0
tag=ska_tango_base-0.10.0
release=0.10.1
tag=ska_tango_base-0.10.1
......@@ -25,8 +25,10 @@ The ska-tango-base repository includes a set of eight classes as mentioned in SK
## Version History
#### Not released yet
#### 0.10.1
- Make dependency on `pytango` and `numpy` python packages explicit.
- Add optional "key" parameter to `SKASubarrayResourceManager` to filter JSON for
assign & release methods.
#### 0.10.0
- Add `DebugDevice` command to `SKABaseDevice`. This allows remote debugging to be
......
......@@ -7,7 +7,7 @@
"""Release information for ska_tango_base Python Package"""
name = """ska_tango_base"""
version = "0.10.0"
version = "0.10.1"
version_info = version.split(".")
description = """A set of generic base devices for SKA Telescope."""
author = "SKA India and SARAO and CSIRO and INAF"
......
......@@ -114,11 +114,14 @@ class SKASubarrayResourceManager:
A simple class for managing subarray resources
"""
def __init__(self):
def __init__(self, key: str = "example"):
"""
Constructor for SKASubarrayResourceManager
:param key: Key used to select from JSON input to assign/release methods.
"""
self._resources = set()
self._key = key
def __len__(self):
"""
......@@ -136,15 +139,15 @@ class SKASubarrayResourceManager:
Assign some resources
:todo: Currently implemented for testing purposes to take a JSON
string encoding a dictionary with key 'example'. In future this
string encoding a dictionary. In future this
will take a collection of resources.
:param resources: JSON-encoding of a dictionary, with resources to
assign under key 'example'
assign under the configured key (default 'example')
:type resources: JSON string
"""
resources_dict = json.loads(resources)
add_resources = resources_dict['example']
add_resources = resources_dict[self._key]
self._resources |= set(add_resources)
def release(self, resources):
......@@ -152,15 +155,15 @@ class SKASubarrayResourceManager:
Release some resources
:todo: Currently implemented for testing purposes to take a JSON
string encoding a dictionary with key 'example'. In future this
string encoding a dictionary. In future this
will take a collection of resources.
:param resources: JSON-encoding of a dictionary, with resources to
assign under key 'example'
assign under the configured key (default 'example')
:type resources: JSON string
"""
resources_dict = json.loads(resources)
drop_resources = resources_dict['example']
drop_resources = resources_dict[self._key]
self._resources -= set(drop_resources)
def release_all(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment