Commit 3d7375dd authored by M. Huang's avatar M. Huang
Browse files

typo, if no existence then register

Showing with 18 additions and 15 deletions
+18 -15
__version_info__ = (2, 4, 6)
__version_info__ = (2, 5, 0)
__version__ = '.'.join(map(str, __version_info__))
__revision__ = '2.4.0.1-1-g07a0c44'
# more info if cannot save to pool
# typo, if no existence then register
# 2.4.6 more info if cannot save to pool
# 2.4.5 fix include
# 2.4.4 pool notexist
# 2.4.3 upload visible
......@@ -31,7 +32,7 @@ __revision__ = '2.4.0.1-1-g07a0c44'
# 2.0.11 get cloudd_token
# 2.0.10 paho mqtt back to == 1.6.1 in setup.py
# 2.0.9 fix fragile error hadling of fdi_requests
# 2.0.8 add toPng debug code
# 2.0.8 add toPrrng debug code
# 2.0.7 update tofits to image. paho reverted
# 2.0.6 shanghai
# 2.0.5 refactor iupload csdt prof defn code to main repo. get bin output ready in `toPng`
......
......@@ -90,7 +90,7 @@ class ProductStorage(object):
if issubclass(pool.__class__, str) and not poolname:
pool, poolname = poolname, pool
with self._locks['w'], self._locks['r']:
if pool and issubclass(pool.__class__, ProductPool):
if pool is not None and issubclass(pool.__class__, ProductPool):
_p = self.PM.getPool(pool=pool, read_only=read_only, **kwds)
from fdi.pal.publicclientpool import PublicClientPool
if issubclass(pool.__class__, PublicClientPool):
......@@ -98,7 +98,7 @@ class ProductStorage(object):
if not pe:
if not makenew:
raise ServerError(
f"CSDB {pool.poolurl} is made but does not exist on the server." +\
f"CSDB {pool.poolurl} is made but does not exist on the server." + \
(", no makenew. Please make it with `ProductStorage`." if makenew else "."))
......@@ -223,16 +223,14 @@ class ProductStorage(object):
raise ValueError('None is not a valid pool name in the `PoolManager`.')
elif poolname not in self._pools:
#self.register(poolname)
logger.warning('$$$ NOT self registering '+poolname)
logger.warning('$$$ NOT registered and self registering '+poolname)
if logger.getEffectiveLevel() <= logging.DEBUG:
desc = [x.description[-6:] for x in product] if issubclass(
product.__class__, list) else product.description[-6:]
logger.debug('saving product:' + lls(desc,300) +
' to pool ' + str(poolname) + ' with tag ' +
str(tag) + f' the writeable pool is {wp.poolurl}, which {"exists" if wp.poolExists() else "does not exist"}')
logger.debug('saving product:' + lls(desc,300) + \
' to pool ' + str(poolname) + ' with tag ' + \
str(tag) + f' The writeable pool is {wp.poolurl}, which {"exists" if wp.poolExists() else "does not exist"}')
If not wp.poolExists():
self.register(poolname=poolname, pool=wp, make_new=True)
try:
ret = self._pools[poolname].saveProduct(
......@@ -416,7 +414,7 @@ class ProductStorage(object):
---------
pool_or_urn : str, ProductPool
Can be a poolname, a pool object, or a URN.
If URN, returns product existence; if pool name or pool, returns that of the pool in storage.
"""
if issubclass(pool_or_urn.__class__, str):
if pool_or_urn.startswith('urn:'):
......
......@@ -178,9 +178,13 @@ def getToken(poolurl, client, user_urlbase=None, verify=False, two_tries= False)
if not tokenMsg2:
logger.error(f'Cannot get token 2nd try from: {poolurl} at {user_urlbase} getting msg: {tokenMsg2}.')
return ''
token = tokenMsg2['token']
else:
try:
token = tokenMsg2['token']
except KeyError as e:
logger.error(f'Did not get token 2 tries from: {poolurl} @ {user_urlbase} getting msg: {tokenMsg2}.')
return ''
else:
return ''
else:
token = current_token
......
......@@ -580,7 +580,7 @@ def load_from_cloud(requestName, client=None, asyn=False, server_type='csdb', us
res = reqst('post', apis, data=data,
headers=headers, server_type=server_type, auth=client.auth, **kwds)
else:
logger.info(f'upload {apis}, {files}, {data}, {headers}')
logger.info(f'upload apis:{apis}, files:{lls(files,200)}, data={lls(data,200)}, headers:{headers} auth={client.auth}')
res = []
for a, f, d, h in zip(apis, files, data, headers):
r = reqst(client.post, a, files=f, data=d,
......
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