psr-factory 5.0.0b14__py3-none-win_amd64.whl → 5.0.0b15__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 +3 -1
- psr/execqueue/client.py +4 -12
- psr/execqueue/server.py +4 -4
- psr/execqueue/watcher.py +5 -1
- psr/factory/__init__.py +1 -1
- psr/factory/factory.dll +0 -0
- psr/factory/factory.pmd +2 -1
- psr/factory/factory.pmk +1 -0
- {psr_factory-5.0.0b14.dist-info → psr_factory-5.0.0b15.dist-info}/METADATA +67 -1
- {psr_factory-5.0.0b14.dist-info → psr_factory-5.0.0b15.dist-info}/RECORD +13 -13
- {psr_factory-5.0.0b14.dist-info → psr_factory-5.0.0b15.dist-info}/WHEEL +0 -0
- {psr_factory-5.0.0b14.dist-info → psr_factory-5.0.0b15.dist-info}/licenses/LICENSE.txt +0 -0
- {psr_factory-5.0.0b14.dist-info → psr_factory-5.0.0b15.dist-info}/top_level.txt +0 -0
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) ->
|
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({'
|
302
|
+
return jsonify({'message': 'Execution finished with errors'}), 200
|
303
303
|
elif status == db.CloudStatus.RUNNING.value:
|
304
|
-
return jsonify({'
|
304
|
+
return jsonify({'message': 'Execution not finished yet'}), 200
|
305
305
|
elif status == db.CloudStatus.FINISHED.value:
|
306
|
-
return jsonify({'
|
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({'
|
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
|
-
|
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
psr/factory/factory.dll
CHANGED
Binary file
|
psr/factory/factory.pmd
CHANGED
@@ -4875,6 +4875,7 @@ DEFINE_MODEL MODL:SDDP_V10.2_ReservaGeracao
|
|
4875
4875
|
PARM REAL Penalty DEFAULT -1
|
4876
4876
|
PARM INTEGER Exclusive DEFAULT 0
|
4877
4877
|
PARM INTEGER LimitType DEFAULT 0
|
4878
|
+
PARM INTEGER Sense DEFAULT 0
|
4878
4879
|
PARM INTEGER Type
|
4879
4880
|
PARM INTEGER CompensateNoSel
|
4880
4881
|
PARM INTEGER CompensateSel
|
@@ -5849,7 +5850,7 @@ DEFINE_MODEL MODL:SDDP_Line
|
|
5849
5850
|
VECTOR REAL CostFromTo DIM(block) INDEX DateCostFromTo
|
5850
5851
|
VECTOR DATE DateCostToFrom @addyear_chronological
|
5851
5852
|
VECTOR REAL CostToFrom DIM(block) INDEX DateCostToFrom
|
5852
|
-
|
5853
|
+
|
5853
5854
|
PARM INTEGER MaxSecondaryReserveUnit
|
5854
5855
|
PARM INTEGER HasMaxSecondaryReserve
|
5855
5856
|
VETOR DATE DataMaxSecondaryReserve @chronological @addyear_chronological
|
psr/factory/factory.pmk
CHANGED
@@ -9753,6 +9753,7 @@ Penalty REAL 41,50 AUTOSET(model.parm("Penalty"))
|
|
9753
9753
|
Exclusive INTEGER 52,52 AUTOSET(model.parm("Exclusive"))
|
9754
9754
|
LimitType INTEGER 54,54 AUTOSET(model.parm("LimitType"))
|
9755
9755
|
ReserveAreaCode INTEGER 56,59
|
9756
|
+
Sense INTEGER 61,64 AUTOSET(model.parm("Sense"))
|
9756
9757
|
END_DATA
|
9757
9758
|
|
9758
9759
|
END_BLOCK
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: psr-factory
|
3
|
-
Version: 5.0.
|
3
|
+
Version: 5.0.0b15
|
4
4
|
Summary: PSR database management module.
|
5
5
|
Author-email: "PSR Inc." <psrfactory@psr-inc.com>
|
6
6
|
License-Expression: MIT
|
@@ -55,3 +55,69 @@ Requires-Dist: pefile; extra == "all"
|
|
55
55
|
Requires-Dist: boto3; extra == "all"
|
56
56
|
Requires-Dist: botocore; extra == "all"
|
57
57
|
Dynamic: license-file
|
58
|
+
|
59
|
+
PSR Factory (version 4.0.37)
|
60
|
+
============================
|
61
|
+
|
62
|
+
Factory is a library that helps to manage SDDP cases.
|
63
|
+
It contains functions that create, load, and save studies, and also functions that create,
|
64
|
+
access, and modify objects in a study.
|
65
|
+
|
66
|
+
|
67
|
+
Installation
|
68
|
+
------------
|
69
|
+
|
70
|
+
### System-wide installation
|
71
|
+
|
72
|
+
Open the command prompt and run the following command:
|
73
|
+
|
74
|
+
```bash
|
75
|
+
pip install psr_factory-4.0.37-py3-none-win_amd64.whl
|
76
|
+
```
|
77
|
+
|
78
|
+
Factory will be available to all Python scripts in your system after importing it:
|
79
|
+
|
80
|
+
```python
|
81
|
+
import psr.factory
|
82
|
+
```
|
83
|
+
|
84
|
+
### Local/project-specific usage
|
85
|
+
|
86
|
+
Copy the folder `psr` and its contents to your project folder or a specific folder (e.g., `C:\path\to\factory`). Then, in your Python script, add the following lines:
|
87
|
+
|
88
|
+
```python
|
89
|
+
import sys
|
90
|
+
sys.path.append(r"C:\path\to\factory")
|
91
|
+
import psr.factory
|
92
|
+
```
|
93
|
+
|
94
|
+
|
95
|
+
Usage sample
|
96
|
+
------------
|
97
|
+
|
98
|
+
```python
|
99
|
+
import psr.factory
|
100
|
+
|
101
|
+
study = psr.factory.load_study(r"C:\temp\my\study")
|
102
|
+
system_1 = study.find("System.*")[0]
|
103
|
+
|
104
|
+
battery = psr.factory.create("Battery")
|
105
|
+
battery.code = 1
|
106
|
+
battery.name = "Battery 1"
|
107
|
+
battery.set("InstalledCapacity", 10.0)
|
108
|
+
battery.set("RefSystem", system_1)
|
109
|
+
study.add(battery)
|
110
|
+
|
111
|
+
study.save(r"C:\temp\my\updated_study")
|
112
|
+
```
|
113
|
+
|
114
|
+
|
115
|
+
Full documentation
|
116
|
+
------------------
|
117
|
+
|
118
|
+
The full documentation and reference is available at [https://docs.psr-inc.com/factory/](https://docs.psr-inc.com/manual/factory/).
|
119
|
+
|
120
|
+
Releases
|
121
|
+
--------
|
122
|
+
|
123
|
+
New releases can be found in the release notes at [https://psrenergy-docs.github.io/factory/releases.html](https://psrenergy-docs.github.io/factory/releases.html).
|
@@ -3,7 +3,7 @@ psr/apps/apps.py,sha256=V8Ewht7P1I-3sSkV3dnbxbLjF2slxPjcmtzmVaLjiNY,6746
|
|
3
3
|
psr/apps/version.py,sha256=vs459L6JsatAkUxna7BNG-vMCaXpO1Ye8c1bmkEx4U4,194
|
4
4
|
psr/cloud/__init__.py,sha256=inZMwG7O9Fca9hg1BhqYObOYtTTJOkpuTIuXnkHJZkI,246
|
5
5
|
psr/cloud/aws.py,sha256=ro8kBNVxpGDXgZ5haceqX-MAD-0F5KFDJJ4M6rRvwS8,9915
|
6
|
-
psr/cloud/cloud.py,sha256=
|
6
|
+
psr/cloud/cloud.py,sha256=RNFUXCAj4IRAMWUUyiEeZfwOqVVZdN28UZPLPSbm-5Y,59207
|
7
7
|
psr/cloud/data.py,sha256=oDJyzcNsA7aAYi_qJKCUjCeGZvN-25E8KjZ-5RamNLE,4160
|
8
8
|
psr/cloud/desktop.py,sha256=JFroCMEFV1Nz3has74n7OVrGCg2lS7Ev5bcjdw2hRxY,2980
|
9
9
|
psr/cloud/log.py,sha256=Dvhz1enIWlFWeaRK7JAAuZVPfODgoEIRNcHEmbEliyQ,1366
|
@@ -11,16 +11,16 @@ psr/cloud/status.py,sha256=vcI4B9S6wCt9maT5NNrVwYaEgGIvy6kkC1UVpJjYbtw,3607
|
|
11
11
|
psr/cloud/tempfile.py,sha256=1IOeye0eKWnmBynK5K5FMWiTaEVhn4GbQ8_y0THEva0,3893
|
12
12
|
psr/cloud/version.py,sha256=jwq5nQsan38iZF0lj5GFK7l9EIe4aSF1NzdcupAfHP4,192
|
13
13
|
psr/cloud/xml.py,sha256=ac2lyflOQm8khPvJn0zmI26I4sfUDY6A_OTsxzbMQEs,1896
|
14
|
-
psr/execqueue/client.py,sha256=
|
14
|
+
psr/execqueue/client.py,sha256=EjhXXWZli8MZP1rkKuYA1EL-VxO4aAUYZKsRa1mrG6Q,4374
|
15
15
|
psr/execqueue/config.py,sha256=3KVwASOgRlymOSPeabotgBdLVB5sPKnPQ9og2q3LQfw,1418
|
16
16
|
psr/execqueue/db.py,sha256=0pH5ksXChz6PR_GQs6OPokK3zVkY1-OZRAqYbVIEh9k,8281
|
17
|
-
psr/execqueue/server.py,sha256=
|
18
|
-
psr/execqueue/watcher.py,sha256=
|
19
|
-
psr/factory/__init__.py,sha256=
|
17
|
+
psr/execqueue/server.py,sha256=IwqVq0hTMAqAyvCF7FXQsf8i82NyWq2BjnZFDOjwg9s,13936
|
18
|
+
psr/execqueue/watcher.py,sha256=34TdU6quJIjWoOBlIbP1fA6fxaX5WmV1tAhvrIL30Uo,5213
|
19
|
+
psr/factory/__init__.py,sha256=3FZ_2un2wbep3zmXTR8RmbWZiqG914IRpuZxWPGPH0c,219
|
20
20
|
psr/factory/api.py,sha256=S7xoNxSKkyPEGtOLa_jBah59Edn39_wtoVQUrwrA6uk,100481
|
21
|
-
psr/factory/factory.dll,sha256=
|
22
|
-
psr/factory/factory.pmd,sha256=
|
23
|
-
psr/factory/factory.pmk,sha256=
|
21
|
+
psr/factory/factory.dll,sha256=H9Y85_SnrGwiGN21wfy3BYx3v9ZmpFOU5gPLjvCQ5iQ,18266448
|
22
|
+
psr/factory/factory.pmd,sha256=0bMTABqJvBVpHQLLVg5E-EJCbiST5mGjQnTgrXgYpyI,243155
|
23
|
+
psr/factory/factory.pmk,sha256=2kvj37seFO_POOqRIdOZuWRs4wSZuWT7z1LuaXi6qbg,579764
|
24
24
|
psr/factory/factorylib.py,sha256=-8wOx9h5oys0ZbG12OptwjzJVrgc48AgiAkBJJPKfio,27829
|
25
25
|
psr/factory/libcurl-x64.dll,sha256=E3rWQwQR-0-CxqJMpTF3PRS-P_6I-9so2hOTzRfKbMA,5317968
|
26
26
|
psr/factory/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -33,8 +33,8 @@ psr/psrfcommon/tempfile.py,sha256=5S13wa2DCLYTUdwbLm_KMBRnDRJ0WDlu8GO2BmZoNdg,39
|
|
33
33
|
psr/runner/__init__.py,sha256=kI9HDX-B_LMQJUHHylFHas2rNpWfNNa0pZXoIvX_Alw,230
|
34
34
|
psr/runner/runner.py,sha256=L_YOCArpkr_O-UJH6aT3K46NlEYT_o7LA1Ldk81BULQ,27326
|
35
35
|
psr/runner/version.py,sha256=mch2Y8anSXGMn9w72Z78PhSRhOyn55EwaoLAYhY4McE,194
|
36
|
-
psr_factory-5.0.
|
37
|
-
psr_factory-5.0.
|
38
|
-
psr_factory-5.0.
|
39
|
-
psr_factory-5.0.
|
40
|
-
psr_factory-5.0.
|
36
|
+
psr_factory-5.0.0b15.dist-info/licenses/LICENSE.txt,sha256=N6mqZK2Ft3iXGHj-by_MHC_dJo9qwn0URjakEPys3H4,1089
|
37
|
+
psr_factory-5.0.0b15.dist-info/METADATA,sha256=jc4ppv3v5A_ZPesDAyd6hDMhpqiHcrSG8rJSNcYc5rU,3957
|
38
|
+
psr_factory-5.0.0b15.dist-info/WHEEL,sha256=ZjXRCNaQ9YSypEK2TE0LRB0sy2OVXSszb4Sx1XjM99k,97
|
39
|
+
psr_factory-5.0.0b15.dist-info/top_level.txt,sha256=Jb393O96WQk3b5D1gMcrZBLKJJgZpzNjTPoldUi00ck,4
|
40
|
+
psr_factory-5.0.0b15.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|