qmenta-client 1.1.dev1429__py3-none-any.whl → 1.1.dev1444__py3-none-any.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.
qmenta/client/Project.py
CHANGED
|
@@ -1693,6 +1693,95 @@ class Project:
|
|
|
1693
1693
|
|
|
1694
1694
|
return True
|
|
1695
1695
|
|
|
1696
|
+
def restart_analysis(self, analysis_id):
|
|
1697
|
+
"""
|
|
1698
|
+
Restart an analysis. Only worklows can be restarted, the finished
|
|
1699
|
+
tools within the workflow will be kept and the missing ones
|
|
1700
|
+
(which probably previously failed) will start. This process maintains
|
|
1701
|
+
the flow of the workflow.
|
|
1702
|
+
|
|
1703
|
+
Tools can not be restarted given that they are considered as single
|
|
1704
|
+
processing units. You can start execution of another analysis instead.
|
|
1705
|
+
|
|
1706
|
+
For the workflow to restart, all its failed child must be removed first.
|
|
1707
|
+
You can only restart your own analysis.
|
|
1708
|
+
|
|
1709
|
+
:param analysis_id: id of the analysis to be restarted
|
|
1710
|
+
:type analysis_id: Int
|
|
1711
|
+
"""
|
|
1712
|
+
logger = logging.getLogger(logger_name)
|
|
1713
|
+
|
|
1714
|
+
analysis = self.list_analysis({"id": analysis_id})[0]
|
|
1715
|
+
|
|
1716
|
+
if analysis.get("super_analysis_type") != 1:
|
|
1717
|
+
raise ValueError("The analysis indicated is not a workflow and hence, it cannot be restarted.")
|
|
1718
|
+
|
|
1719
|
+
try:
|
|
1720
|
+
platform.parse_response(
|
|
1721
|
+
platform.post(
|
|
1722
|
+
auth=self._account.auth,
|
|
1723
|
+
endpoint="analysis_manager/restart_analysis",
|
|
1724
|
+
data={"analysis_id": analysis_id},
|
|
1725
|
+
timeout=1000,
|
|
1726
|
+
)
|
|
1727
|
+
)
|
|
1728
|
+
except errors.PlatformError as error:
|
|
1729
|
+
logger.error("Could not delete analysis: {}".format(error))
|
|
1730
|
+
return False
|
|
1731
|
+
|
|
1732
|
+
return True
|
|
1733
|
+
|
|
1734
|
+
def get_analysis_log(self, analysis_id, file_name=None):
|
|
1735
|
+
"""
|
|
1736
|
+
Get the log of an analysis and save it in the provided file.
|
|
1737
|
+
The logs of analysis can only be obtained for the tools you created.
|
|
1738
|
+
|
|
1739
|
+
Note workflows do not have a log so the printed message will only be ERROR.
|
|
1740
|
+
You can only download the anlaysis log of the tools that you own.
|
|
1741
|
+
|
|
1742
|
+
Note this method is very time consuming.
|
|
1743
|
+
|
|
1744
|
+
Parameters
|
|
1745
|
+
----------
|
|
1746
|
+
analysis_id : int
|
|
1747
|
+
ID of the script to be run.
|
|
1748
|
+
file_name: str
|
|
1749
|
+
Path to the file where to export the log.
|
|
1750
|
+
If None the file will be: f'logs_{analysis_id}.txt'
|
|
1751
|
+
|
|
1752
|
+
Returns
|
|
1753
|
+
-------
|
|
1754
|
+
str or bool
|
|
1755
|
+
File name of the exported file if the export is possible.
|
|
1756
|
+
False otherwise.
|
|
1757
|
+
"""
|
|
1758
|
+
logger = logging.getLogger(logger_name)
|
|
1759
|
+
try:
|
|
1760
|
+
analysis_id = str(int(analysis_id))
|
|
1761
|
+
except ValueError:
|
|
1762
|
+
raise ValueError(f"'analysis_id' has to be an integer"
|
|
1763
|
+
f" not '{analysis_id}'.")
|
|
1764
|
+
|
|
1765
|
+
file_name = file_name if file_name else f"logs_{analysis_id}.txt"
|
|
1766
|
+
try:
|
|
1767
|
+
res = platform.post(
|
|
1768
|
+
auth=self._account.auth,
|
|
1769
|
+
endpoint="analysis_manager/download_execution_file",
|
|
1770
|
+
data={"project_id": analysis_id, "file": f"logs_{analysis_id}"},
|
|
1771
|
+
timeout=1000
|
|
1772
|
+
)
|
|
1773
|
+
except Exception:
|
|
1774
|
+
logger.error(f"Could not export the analysis log of '{analysis_id}'")
|
|
1775
|
+
return False
|
|
1776
|
+
|
|
1777
|
+
if not res.ok:
|
|
1778
|
+
logger.error(f"The log file could not be extracted for Analysis ID: {analysis_id}.")
|
|
1779
|
+
return False
|
|
1780
|
+
|
|
1781
|
+
with open(file_name, "w") as f:
|
|
1782
|
+
f.write(res.text)
|
|
1783
|
+
return file_name
|
|
1784
|
+
|
|
1696
1785
|
""" QC Status Related Methods """
|
|
1697
1786
|
|
|
1698
1787
|
def set_qc_status_analysis(self, analysis_id,
|
|
@@ -1952,6 +2041,10 @@ class Project:
|
|
|
1952
2041
|
return False
|
|
1953
2042
|
|
|
1954
2043
|
try:
|
|
2044
|
+
for rule in res["rules"]:
|
|
2045
|
+
del rule["_id"]
|
|
2046
|
+
del rule["order"]
|
|
2047
|
+
del rule["time_modified"]
|
|
1955
2048
|
with open(rules_file_path, "w") as fr:
|
|
1956
2049
|
json.dump(res["rules"], fr, indent=4)
|
|
1957
2050
|
except FileNotFoundError:
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
qmenta/__init__.py,sha256=jv2YF__bseklT3OWEzlqJ5qE24c4aWd5F4r0TTjOrWQ,65
|
|
2
2
|
qmenta/client/Account.py,sha256=S9D0-lmcBln2o3DwJfmLfu5G2wjE7gEJCIeJu89v0Is,9647
|
|
3
3
|
qmenta/client/File.py,sha256=ZgvSqejIosUt4uoX7opUnPnp5XGEaJNMRwFC0mQVB8k,5344
|
|
4
|
-
qmenta/client/Project.py,sha256=
|
|
4
|
+
qmenta/client/Project.py,sha256=7MPUskUznuCSN7SOdNyIZckDcnBnJvlMnIoIbF3KvzE,83483
|
|
5
5
|
qmenta/client/Subject.py,sha256=lhxxVdQ6d-GNoQC8mrJwa4L1f44nJc4PcJtDspmKN7I,8756
|
|
6
6
|
qmenta/client/__init__.py,sha256=AjTojBhZeW5nl0i605KS8S1Gl5tPNc1hdzD47BGNfoI,147
|
|
7
7
|
qmenta/client/utils.py,sha256=5DK2T_HQprrCwLS0Ycm2CjseaYmAUKaJkJvYoW-Rqzc,2479
|
|
8
|
-
qmenta_client-1.1.
|
|
9
|
-
qmenta_client-1.1.
|
|
10
|
-
qmenta_client-1.1.
|
|
8
|
+
qmenta_client-1.1.dev1444.dist-info/METADATA,sha256=dNf9vlNtJKHYdXVgbu-rYvsHb5eQ7q_UVWz-ymM5Vb8,672
|
|
9
|
+
qmenta_client-1.1.dev1444.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
10
|
+
qmenta_client-1.1.dev1444.dist-info/RECORD,,
|
|
File without changes
|