Skip to content

Commit

Permalink
Merge pull request #22 from simonsobs/koopman/client-initialization
Browse files Browse the repository at this point in the history
Improve client intialization
  • Loading branch information
BrianJKoopman authored Jun 14, 2022
2 parents af09427 + 647bc81 commit 08f638c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# tmp files
*.swp

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
16 changes: 10 additions & 6 deletions src/sorunlib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,21 @@ def create_clients(config=None, test_mode=False):
'smurf': [smurf_client1, smurf_client2, smurf_client3]}
"""
clients = {}

if test_mode:
smurf_agent_class = 'SmurfFileEmulator'
else:
smurf_agent_class = 'PysmurfController'

acu_id = _find_instances('ACUAgent', config)
smurf_ids = _find_instances(smurf_agent_class, config)
acu_id = _find_instances('ACUAgent', config=config)
smurf_ids = _find_instances(smurf_agent_class, config=config)

acu_client = OCSClient(acu_id[0])
smurf_clients = [OCSClient(x) for x in smurf_ids]
if acu_id:
acu_client = OCSClient(acu_id[0])
clients['acu'] = acu_client
if smurf_ids:
smurf_clients = [OCSClient(x) for x in smurf_ids]
clients['smurf'] = smurf_clients

clients = {'acu': acu_client,
'smurf': smurf_clients}
return clients

0 comments on commit 08f638c

Please sign in to comment.