psr-factory 5.0.0b14__py3-none-win_amd64.whl → 5.0.0b16__py3-none-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
psr/cloud/cloud.py CHANGED
@@ -961,7 +961,9 @@ class Client:
961
961
  "sessao_id": section,
962
962
  "tipo_autenticacao": "bcrypt",
963
963
  "idioma": "3",
964
- "versao_cliente": self._get_console_version().split("-")[0],
964
+ "versao_cliente": self._get_console_version().split("-")[0]
965
+ if not self._python_client
966
+ else "5.4.0",
965
967
  }
966
968
  if additional_arguments:
967
969
  parameters.update(additional_arguments)
psr/execqueue/client.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import os
2
2
  import zipfile
3
3
  import requests
4
- from typing import List, Optional
4
+ from typing import List, Optional, Tuple
5
5
 
6
6
 
7
7
  def zip_directory(directory_path, output_zip):
@@ -70,21 +70,13 @@ def upload_and_run_file(zip_path: str, server_url: str, cloud_execution: bool =
70
70
  return None
71
71
 
72
72
 
73
- def get_execution_status(execution_id: str, server_url: str, cloud_execution: bool = False, return_status_id: bool = False) -> Optional[str]:
73
+ def get_execution_status(execution_id: str, server_url: str, cloud_execution: bool = False, return_status_id: bool = False) -> Tuple[bool, dict]:
74
74
  """Get the status of an execution."""
75
- print("Getting status for execution ID:", execution_id)
76
75
  data = {'cloud_execution': cloud_execution, 'return_status_id': return_status_id}
77
76
  response = requests.get(f"{server_url}/status/{execution_id}", data=data)
77
+ result = response.status_code == 200
78
+ return result, response.json()
78
79
 
79
- if response.status_code == 200:
80
- if return_status_id:
81
- print("Status ID:", response.json().get('status_id'))
82
- return response.json().get('status_id')
83
- print("Status:", response.json().get('status'))
84
- return response.json().get('status')
85
- else:
86
- print("Failed to get status:", response.text)
87
- return None
88
80
 
89
81
  def get_results(execution_id, server_url, cloud_execution=False) -> Optional[List[str]]:
90
82
  """Download the results of an execution."""
psr/execqueue/server.py CHANGED
@@ -299,13 +299,13 @@ def get_status(execution_id):
299
299
  if return_status_id:
300
300
  return jsonify({'status_id': status}), 200
301
301
  if status == db.CloudStatus.ERROR.value:
302
- return jsonify({'status': 'Execution finished with errors'}), 200
302
+ return jsonify({'message': 'Execution finished with errors'}), 200
303
303
  elif status == db.CloudStatus.RUNNING.value:
304
- return jsonify({'status': 'Execution not finished yet'}), 200
304
+ return jsonify({'message': 'Execution not finished yet'}), 200
305
305
  elif status == db.CloudStatus.FINISHED.value:
306
- return jsonify({'status': 'Execution finished, but download not yet downloaded from Cloud server'}), 200
306
+ return jsonify({'message': 'Execution finished, but download not yet downloaded from Cloud server'}), 200
307
307
  elif status == db.CloudStatus.RESULTS_AVAILABLE.value:
308
- return jsonify({'status': 'Execution finished and results are available to download'}), 200
308
+ return jsonify({'message': 'Execution finished and results are available to download'}), 200
309
309
 
310
310
  @app.route('/results/<execution_id>', methods=['GET'])
311
311
  def get_results(execution_id: str):
psr/execqueue/watcher.py CHANGED
@@ -73,7 +73,10 @@ def _check_and_download_results():
73
73
  rows = cursor.fetchall()
74
74
  for row in rows:
75
75
  record_id, filename, cloud_upload_id = row
76
- status = execqueue.get_execution_status(cloud_upload_id, SERVER_URL, cloud_execution=True, return_status_id=True)
76
+ result, response = execqueue.get_execution_status(cloud_upload_id, SERVER_URL, cloud_execution=True, return_status_id=True)
77
+ status = response.get('status_id', 0)
78
+ message = response.get('message', None)
79
+ error = response.get('error', None)
77
80
  if status == "5" or status == 5:
78
81
  files = execqueue.get_results(cloud_upload_id, SERVER_URL, cloud_execution=True)
79
82
  if files:
@@ -92,6 +95,7 @@ def _check_and_download_results():
92
95
  logging.info(f"Execution {cloud_upload_id} is finished with errors.")
93
96
  cursor.execute("UPDATE processed_files SET downloaded=4 WHERE id=?", (record_id,))
94
97
  conn.commit()
98
+
95
99
  conn.close()
96
100
 
97
101
 
psr/factory/__init__.py CHANGED
@@ -2,6 +2,6 @@
2
2
  # Unauthorized copying of this file, via any medium is strictly prohibited
3
3
  # Proprietary and confidential
4
4
 
5
- __version__ = "5.0.0b14"
5
+ __version__ = "5.0.0b16"
6
6
 
7
7
  from .api import *
psr/factory/api.py CHANGED
@@ -2264,6 +2264,29 @@ class DataFrame(_BaseObject):
2264
2264
  return df_builder.build_polars_dataframe(use_object_dtype=False)
2265
2265
 
2266
2266
 
2267
+ def get(self, expression: str) -> Union[int, float, dt.datetime, str, "DataObject", list, None]:
2268
+ value = Value()
2269
+ _err = Error()
2270
+ factorylib.lib.psrd_table_get_property(self._hdr,
2271
+ _c_str(expression),
2272
+ value.handler(),
2273
+ _err.handler())
2274
+ if _err.code != 0:
2275
+ raise FactoryException(_err.what)
2276
+ return value.get()
2277
+
2278
+ def set(self, expression: str, value):
2279
+ _err = Error()
2280
+ _val = Value()
2281
+ _val.set(value)
2282
+ factorylib.lib.psrd_table_set_property(self._hdr, _c_str(expression),
2283
+ _bytes(expression),
2284
+ _val.handler(),
2285
+ _err.handler())
2286
+ if _err.code != 0:
2287
+ raise FactoryException(_err.what)
2288
+
2289
+
2267
2290
  def load_dataframe(input_file: Union[str, pathlib.Path], **kwargs) -> DataFrame:
2268
2291
  options = kwargs.get("options", None)
2269
2292
  return DataFrame.load_from_file(input_file, options)
psr/factory/factory.dll CHANGED
Binary file