Skip to content
Snippets Groups Projects
Commit 50622c66 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Merge branch 'roiset_api' into 'staging'

Changes supporting AutoMic integration

See merge request !15
parents 9b5fec53 eb587fe8
No related branches found
No related tags found
3 merge requests!37Release 2024.04.19,!34Revert "Temporary error-handling for debug...",!15Changes supporting AutoMic integration
...@@ -294,7 +294,7 @@ class RoiSet(object): ...@@ -294,7 +294,7 @@ class RoiSet(object):
mask_largest_object( mask_largest_object(
obmap_patches.iat(i).data obmap_patches.iat(i).data
) )
)[1] )[-1]
self._df.loc[roi.Index, 'classify_by_' + name] = oc self._df.loc[roi.Index, 'classify_by_' + name] = oc
om[self.acc_obj_ids.data == roi.label] = oc om[self.acc_obj_ids.data == roi.label] = oc
self.object_class_maps[name] = InMemoryDataAccessor(om) self.object_class_maps[name] = InMemoryDataAccessor(om)
......
...@@ -6,6 +6,7 @@ import httplib ...@@ -6,6 +6,7 @@ import httplib
import json import json
import urllib import urllib
from ij import IJ
from ij import ImagePlus from ij import ImagePlus
HOST = '127.0.0.1' HOST = '127.0.0.1'
...@@ -36,6 +37,28 @@ def hit_endpoint(method, endpoint, params=None): ...@@ -36,6 +37,28 @@ def hit_endpoint(method, endpoint, params=None):
content = {'str': str(resp_str)} content = {'str': str(resp_str)}
return {'status': resp.status, 'content': content} return {'status': resp.status, 'content': content}
def verify_server(popup=True):
try:
resp = hit_endpoint('GET', '/')
except Exception as e:
print(e)
msg = 'Could not find server at: ' + uri
IJ.log(msg)
if popup:
IJ.error(msg)
raise e
return False
if resp['status'] != 200:
msg = 'Unknown error verifying server at: ' + uri
if popup:
IJ.error(msg)
raise Exception(msg)
return False
else:
IJ.log('Verified server is online at: ' + uri)
return True
def run_request_sequence(imp, func, params): def run_request_sequence(imp, func, params):
""" """
Execute a sequence of client requests in the ImageJ scripting environment Execute a sequence of client requests in the ImageJ scripting environment
......
...@@ -27,6 +27,11 @@ def parse_args(): ...@@ -27,6 +27,11 @@ def parse_args():
action='store_true', action='store_true',
help='display extra information that is helpful for debugging' help='display extra information that is helpful for debugging'
) )
parser.add_argument(
'--reload',
action='store_true',
help='automatically restart server when changes are noticed, for development purposes'
)
return parser.parse_args() return parser.parse_args()
...@@ -41,8 +46,9 @@ def main(args, app_name='model_server.base.api:app') -> None: ...@@ -41,8 +46,9 @@ def main(args, app_name='model_server.base.api:app') -> None:
'host': args.host, 'host': args.host,
'port': int(args.port), 'port': int(args.port),
'log_level': 'debug', 'log_level': 'debug',
'reload': args.reload,
}, },
daemon=True, daemon=(args.reload is False),
) )
url = f'http://{args.host}:{int(args.port):04d}/status' url = f'http://{args.host}:{int(args.port):04d}/status'
print(url) print(url)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment