tm1py icon indicating copy to clipboard operation
tm1py copied to clipboard

Raise meaningful exception when no response is returned from TM1

Open MariusWirtz opened this issue 2 years ago • 2 comments

MariusWirtz avatar Jul 20 '22 07:07 MariusWirtz

Hi @sbethea-cw,

please recreate the situation in which TM1 does not return a response to a request when using this branch of TM1py. TM1py should now raise a TM1pyNoResponseException.

pip uninstall tm1py
pip install https://github.com/cubewise-code/tm1py/archive/refs/heads/feature/informative-exception-when-no-response.zip

MariusWirtz avatar Jul 20 '22 07:07 MariusWirtz

Hi @MariusWirtz, I installed the TM1py version you linked and ran the test, but it did not raise the TM1pyNoResponseException. It still raised the same error: AttributeError: 'NoneType' object has no attribute 'json'

Please see below.

2022-07-27 12:38:41,054 - INFO - Synchronization script... It will synchronize the D365 RR Reporting cube as clstg D365 RR Reporting on tm1cloudusemeadev. 2022-07-27 12:38:42,514 - INFO - Connection to source server (tm1premusprod) completed. 2022-07-27 12:38:43,188 - INFO - Connection to Target server (tm1cloudusemeadev) completed. 2022-07-27 12:38:43,388 - INFO - Target TM1 version is 11.8.00800.5. 2022-07-27 12:38:43,388 - INFO - lasc-tm1-01 --> https://aristo-dev.planning-analytics.cloud.ibm.com/tm1/api/USEMEA%20Dev 2022-07-27 12:38:43,389 - INFO - Determining cube logging setting for the clstg D365 RR Reporting cube on tm1cloudusemeadev. 2022-07-27 12:38:44,232 - INFO - Clearing target data for the clstg D365 RR Reporting cube on tm1cloudusemeadev. 2022-07-27 12:38:44,868 - INFO - Clearing data in clstg D365 RR Reporting via MDX. 2022-07-27 12:39:48,526 - INFO - Clearing data elapsed time: 0:01:03.657925 2022-07-27 12:39:48,526 - INFO - Synchronizing data from the D365 RR Reporting cube on tm1premusprod to the clstg D365 RR Reporting on tm1cloudusemeadev. 2022-07-27 12:39:48,526 - INFO - Start sync_data 2022-07-27 12:39:49,216 - INFO - sync_data: Querying data from D365 RR Reporting to clstg D365 RR Reporting. Max workers: 4. 2022-07-27 12:39:49,216 - INFO - sync_data: Calling transfer_async function 2022-07-27 12:54:39,141 - ERROR - Unexpected Error Traceback (most recent call last): File "C:/Users/Shane/Python/Scripts/Clients/Aristocrat/Data_Sync_Cube_Between_Servers-Retry-NO-TENACITY.py", line 383, in sync_data(tm1_src, tm1_tgt, source_cube, target_cube, source_mdx, slice_size, max_workers, leaves) File "C:/Users/Shane/Python/Scripts/Clients/Aristocrat/Data_Sync_Cube_Between_Servers-Retry-NO-TENACITY.py", line 229, in sync_data asyncio.run(transfer_async(tm1_source, tm1_target, tgt_cube, mdx, max_workers, measure_dimension_elements,async_dim_leaves)) File "C:\ProgramData\Anaconda3\envs\untitled\lib\asyncio\runners.py", line 43, in run return loop.run_until_complete(main) File "C:\ProgramData\Anaconda3\envs\untitled\lib\asyncio\base_events.py", line 616, in run_until_complete return future.result() File "C:/Users/Shane/Python/Scripts/Clients/Aristocrat/Data_Sync_Cube_Between_Servers-Retry-NO-TENACITY.py", line 181, in transfer_async await future File "C:\ProgramData\Anaconda3\envs\untitled\lib\concurrent\futures\thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "C:/Users/Shane/Python/Scripts/Clients/Aristocrat/Data_Sync_Cube_Between_Servers-Retry-NO-TENACITY.py", line 194, in transfer tm1_target.cells.write(tgt_cube, cells, precision=None, measure_dimension_elements=measure_dimension_elements, use_ti=True) File "C:\ProgramData\Anaconda3\envs\untitled\lib\site-packages\TM1py\Services\CellService.py", line 652, in write return self.write_through_unbound_process( File "C:\ProgramData\Anaconda3\envs\untitled\lib\site-packages\TM1py\Utils\Utils.py", line 34, in wrapper return func(self, *args, **kwargs) File "C:\ProgramData\Anaconda3\envs\untitled\lib\site-packages\TM1py\Services\CellService.py", line 92, in wrapper return func(self, *args, **kwargs) File "C:\ProgramData\Anaconda3\envs\untitled\lib\site-packages\TM1py\Services\CellService.py", line 764, in write_through_unbound_process success, status, log_file = self._execute_write_statements(chunk, enable_sandbox, kwargs) File "C:\ProgramData\Anaconda3\envs\untitled\lib\site-packages\TM1py\Services\CellService.py", line 955, in _execute_write_statements return self.execute_unbound_process(process, **kwargs) File "C:\ProgramData\Anaconda3\envs\untitled\lib\site-packages\TM1py\Services\CellService.py", line 969, in execute_unbound_process return process_service.execute_process_with_return(process, **kwargs) File "C:\ProgramData\Anaconda3\envs\untitled\lib\site-packages\TM1py\Utils\Utils.py", line 48, in wrapper return func(self, *args, **kwargs) File "C:\ProgramData\Anaconda3\envs\untitled\lib\site-packages\TM1py\Services\ProcessService.py", line 292, in execute_process_with_return execution_summary = response.json() AttributeError: 'NoneType' object has no attribute 'json' 2022-07-27 12:54:39,157 - INFO -

2022-07-27 12_57_58-Window

sbethea-cw avatar Jul 27 '22 17:07 sbethea-cw