Skip to content

Commit

Permalink
Merge pull request #64 from taylorsteffanj/3.1.5
Browse files Browse the repository at this point in the history
Release 3.1.5
  • Loading branch information
taylorsteffanj authored Sep 26, 2024
2 parents 056634c + f61f41d commit 380fe08
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 15 deletions.
24 changes: 12 additions & 12 deletions ibmpairs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,14 +596,14 @@ async def async_get(self,
if client_response.body is not None:
response_string = client_response.body
if token_refresh_message in response_string:
logger.info(response_string)
logger.debug(response_string)
retry = True
elif ((self._legacy is False) and (client_response.status == 500)):
token_refresh_message = constants.CLIENT_TOKEN_REFRESH_MESSAGE_APIC
if client_response.body is not None:
response_string = str(client_response.body)
if token_refresh_message in response_string:
logger.info(response_string)
logger.debug(response_string)
retry = True

if retry is True:
Expand Down Expand Up @@ -682,14 +682,14 @@ def get(self,
if response.json() is not None:
response_string = json.dumps(response.json())
if token_refresh_message in response_string:
logger.info(response_string)
logger.debug(response_string)
retry = True
elif ((self._legacy is False) and (response.status_code == 500)):
token_refresh_message = constants.CLIENT_TOKEN_REFRESH_MESSAGE_APIC
if response.json() is not None:
response_string = json.dumps(response.json())
if token_refresh_message in response_string:
logger.info(response_string)
logger.debug(response_string)
retry = True

if retry is True:
Expand Down Expand Up @@ -768,14 +768,14 @@ def put(self,
if response.json() is not None:
response_string = json.dumps(response.json())
if token_refresh_message in response_string:
logger.info(response_string)
logger.debug(response_string)
retry = True
elif ((self._legacy is False) and (response.status_code == 500)):
token_refresh_message = constants.CLIENT_TOKEN_REFRESH_MESSAGE_APIC
if response.json() is not None:
response_string = json.dumps(response.json())
if token_refresh_message in response_string:
logger.info(response_string)
logger.debug(response_string)
retry = True

if retry is True:
Expand Down Expand Up @@ -848,14 +848,14 @@ async def async_post(self,
if client_response.body is not None:
response_string = client_response.body
if token_refresh_message in response_string:
logger.info(response_string)
logger.debug(response_string)
retry = True
elif ((self._legacy is False) and (client_response.status == 500)):
token_refresh_message = constants.CLIENT_TOKEN_REFRESH_MESSAGE_APIC
if client_response.body is not None:
response_string = str(client_response.body)
if token_refresh_message in response_string:
logger.info(response_string)
logger.debug(response_string)
retry = True

if retry is True:
Expand Down Expand Up @@ -942,14 +942,14 @@ def post(self,
if response.json() is not None:
response_string = json.dumps(response.json())
if token_refresh_message in response_string:
logger.info(response_string)
logger.debug(response_string)
retry = True
elif ((self._legacy is False) and (response.status_code == 500)):
token_refresh_message = constants.CLIENT_TOKEN_REFRESH_MESSAGE_APIC
if response.json() is not None:
response_string = json.dumps(response.json())
if token_refresh_message in response_string:
logger.info(response_string)
logger.debug(response_string)
retry = True

if retry is True:
Expand Down Expand Up @@ -1029,14 +1029,14 @@ def delete(self,
if response.json() is not None:
response_string = json.dumps(response.json())
if token_refresh_message in response_string:
logger.info(response_string)
logger.debug(response_string)
retry = True
elif ((self._legacy is False) and (response.status_code == 500)):
token_refresh_message = constants.CLIENT_TOKEN_REFRESH_MESSAGE_APIC
if response.json() is not None:
response_string = json.dumps(response.json())
if token_refresh_message in response_string:
logger.info(response_string)
logger.debug(response_string)
retry = True

if retry is True:
Expand Down
34 changes: 33 additions & 1 deletion ibmpairs/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -4659,6 +4659,7 @@ class Query:
#_batch: str
#_processor: List[Processor]
#_debug: bool
#_auto_ingest: bool

# Query Submit Response
#_submit_response: QueryResponse
Expand Down Expand Up @@ -4707,6 +4708,8 @@ class Query:
:type processor: List[ibmpairs.query.Processor]
:param debug: A debug flag.
:type debug: bool
:param auto_ingest: Enables automatic data ingestion
:type auto_ingest: bool
:param id: A Query id.
:type id: str
:param submit_response: A response from the submit phase.
Expand Down Expand Up @@ -4770,6 +4773,7 @@ def __init__(self,
batch: str = None,
processor: List[Processor] = None,
debug: bool = None,
auto_ingest: bool = None,
id: str = None,
submit_response: QueryResponse = None,
status_response: QueryJob = None,
Expand All @@ -4794,6 +4798,7 @@ def __init__(self,
self._batch = batch
self._processor = processor
self._debug = debug
self._auto_ingest = auto_ingest
self._id = id

if submit_response is None:
Expand Down Expand Up @@ -5040,7 +5045,22 @@ def del_debug(self):
del self._debug

#
debug = property(get_debug, set_debug, del_debug)
debug = property(get_debug, set_debug, del_debug)

#
def get_auto_ingest(self):
return self._auto_ingest

#
def set_auto_ingest(self, auto_ingest):
self._auto_ingest = common.check_bool(auto_ingest)

#
def del_auto_ingest(self):
del self._auto_ingest

#
auto_ingest = property(get_auto_ingest, set_auto_ingest, del_auto_ingest)

#
def get_id(self):
Expand Down Expand Up @@ -5187,6 +5207,7 @@ def from_dict(query_dict: Any):
batch = None
processor = None
debug = None
auto_ingest = None
id = None
submit_response = None
status_response = None
Expand Down Expand Up @@ -5242,6 +5263,12 @@ def from_dict(query_dict: Any):
if "debug" in query_dict:
if query_dict.get("debug") is not None:
debug = common.check_bool(query_dict.get("debug"))
if "autoIngest" in query_dict:
if query_dict.get("autoIngest") is not None:
auto_ingest = common.check_bool(query_dict.get("autoIngest"))
elif "auto_ingest" in query_dict:
if query_dict.get("auto_ingest") is not None:
auto_ingest = common.check_bool(query_dict.get("auto_ingest"))
if "id" in query_dict:
if query_dict.get("id") is not None:
id = common.check_str(query_dict.get("id"))
Expand Down Expand Up @@ -5279,6 +5306,7 @@ def from_dict(query_dict: Any):
batch = batch,
processor = processor,
debug = debug,
auto_ingest = auto_ingest,
id = id,
submit_response = submit_response,
status_response = status_response,
Expand Down Expand Up @@ -5325,6 +5353,8 @@ def to_dict(self):
query_dict["processor"] = common.from_list(self._processor, lambda item: common.class_to_dict(item, Processor))
if self._debug is not None:
query_dict["debug"] = self._debug
if self._auto_ingest is not None:
query_dict["auto_ingest"] = self._auto_ingest
if self._id is not None:
query_dict["id"] = self._id
if self._submit_response is not None:
Expand Down Expand Up @@ -5376,6 +5406,8 @@ def to_dict_query_post(self):
query_dict["upload"] = common.class_to_dict(self._upload, Upload)
if self._batch is not None:
query_dict["batch"] = self._batch
if self._auto_ingest is not None:
query_dict["autoIngest"] = self._auto_ingest
if self._processor is not None:
query_dict["processor"] = common.from_list(self._processor, lambda item: item.to_dict())
if self._debug is not None:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup

# define package version
version = '3.1.4'
version = '3.1.5'
# ... and record it for ibmpairs package
with open("ibmpairs/version.py", 'w') as f:
f.write('# generated by setup.py\nversion = "{}"\n'.format(version))
Expand Down
18 changes: 17 additions & 1 deletion tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -3831,6 +3831,8 @@ def test_processor_to_json(self):
"outputLevel": 0,
"description": "string",
"publish": True,
"debug": True,
"autoIngest": True,
"notification":
{
"type": "rabbitmq",
Expand Down Expand Up @@ -3932,6 +3934,8 @@ def test_processor_to_json(self):
"outputLevel": 0,
"description": "string",
"publish": true,
"debug": true,
"autoIngest": true,
"notification":
{
"type": "rabbitmq",
Expand Down Expand Up @@ -4416,6 +4420,8 @@ def test_query_init(self):
processor.type = "string"
processor.options = [options]
query.processor = [processor]
query.debug = True
query.auto_ingest = True
except Exception as ex:
got_exception = True

Expand Down Expand Up @@ -4459,8 +4465,10 @@ def test_query_init(self):
self.assertEqual(query.processor[0].type, "string")
self.assertEqual(query.processor[0].options[0].name, "string")
self.assertEqual(query.processor[0].options[0].value, "string")
self.assertEqual(query.debug, True)
self.assertEqual(query.auto_ingest, True)

#
#
def test_query_from_dict(self):
self.logger.info('test_query_from_dict')

Expand Down Expand Up @@ -4504,6 +4512,8 @@ def test_query_from_dict(self):
self.assertEqual(query_from_dict.output_level, 0)
self.assertEqual(query_from_dict.description, "string")
self.assertEqual(query_from_dict.publish, True)
self.assertEqual(query_from_dict.debug, True)
self.assertEqual(query_from_dict.auto_ingest, True)
self.assertEqual(query_from_dict.notification.type, "rabbitmq")
self.assertEqual(query_from_dict.notification.host, "string")
self.assertEqual(query_from_dict.notification.queue, "string")
Expand Down Expand Up @@ -4567,6 +4577,8 @@ def test_query_to_dict(self):
self.assertEqual(query_to_dict["output_level"], 0)
self.assertEqual(query_to_dict["description"], "string")
self.assertEqual(query_to_dict["publish"], True)
self.assertEqual(query_to_dict["debug"], True)
self.assertEqual(query_to_dict["auto_ingest"], True)
self.assertEqual(query_to_dict["notification"]["type"], "rabbitmq")
self.assertEqual(query_to_dict["notification"]["host"], "string")
self.assertEqual(query_to_dict["notification"]["queue"], "string")
Expand Down Expand Up @@ -4630,6 +4642,8 @@ def test_query_to_dict_query_post(self):
self.assertEqual(query_to_dict_query_post["outputLevel"], 0)
self.assertEqual(query_to_dict_query_post["description"], "string")
self.assertEqual(query_to_dict_query_post["publish"], True)
self.assertEqual(query_to_dict_query_post["debug"], True)
self.assertEqual(query_to_dict_query_post["autoIngest"], True)
self.assertEqual(query_to_dict_query_post["notification"]["type"], "rabbitmq")
self.assertEqual(query_to_dict_query_post["notification"]["host"], "string")
self.assertEqual(query_to_dict_query_post["notification"]["queue"], "string")
Expand Down Expand Up @@ -4691,6 +4705,8 @@ def test_query_from_json(self):
self.assertEqual(query_from_json.output_level, 0)
self.assertEqual(query_from_json.description, "string")
self.assertEqual(query_from_json.publish, True)
self.assertEqual(query_from_json.debug, True)
self.assertEqual(query_from_json.auto_ingest, True)
self.assertEqual(query_from_json.notification.type, "rabbitmq")
self.assertEqual(query_from_json.notification.host, "string")
self.assertEqual(query_from_json.notification.queue, "string")
Expand Down

0 comments on commit 380fe08

Please sign in to comment.