qmenta-client 1.1.dev1429__py3-none-any.whl → 1.1.dev1436__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,57 @@ class Project:
1693
1693
 
1694
1694
  return True
1695
1695
 
1696
+ def get_analysis_log(self, analysis_id, file_name=None):
1697
+ """
1698
+ Get the log of an analysis and save it in the provided file.
1699
+ The logs of analysis can only be obtained for the tools you created.
1700
+
1701
+ Note workflows do not have a log so the printed message will only be ERROR.
1702
+ You can only download the anlaysis log of the tools that you own.
1703
+
1704
+ Note this method is very time consuming.
1705
+
1706
+ Parameters
1707
+ ----------
1708
+ analysis_id : int
1709
+ ID of the script to be run.
1710
+ file_name: str
1711
+ Path to the file where to export the log.
1712
+ If None the file will be: f'logs_{analysis_id}.txt'
1713
+
1714
+ Returns
1715
+ -------
1716
+ str or bool
1717
+ File name of the exported file if the export is possible.
1718
+ False otherwise.
1719
+ """
1720
+ logger = logging.getLogger(logger_name)
1721
+ try:
1722
+ analysis_id = str(int(analysis_id))
1723
+ except ValueError:
1724
+ raise ValueError(f"'analysis_id' has to be an integer"
1725
+ f" not '{analysis_id}'.")
1726
+
1727
+ file_name = file_name if file_name else f"logs_{analysis_id}.txt"
1728
+ try:
1729
+ res = platform.post(
1730
+ auth=self._account.auth,
1731
+ endpoint="analysis_manager/download_execution_file",
1732
+ data={"project_id": analysis_id, "file": f"logs_{analysis_id}"},
1733
+ timeout=1000
1734
+ )
1735
+ except Exception:
1736
+ logger.error(f"Could not export the analysis log of '{analysis_id}'")
1737
+ return False
1738
+
1739
+ if not res.ok:
1740
+ logger.error(f"The log file could not be extracted for Analysis ID: {analysis_id}.")
1741
+ return False
1742
+
1743
+ with open(file_name, "w") as f:
1744
+ f.write(res.text)
1745
+ return file_name
1746
+
1696
1747
  """ QC Status Related Methods """
1697
1748
 
1698
1749
  def set_qc_status_analysis(self, analysis_id,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: qmenta-client
3
- Version: 1.1.dev1429
3
+ Version: 1.1.dev1436
4
4
  Summary: Python client lib to interact with the QMENTA platform.
5
5
  Author: QMENTA
6
6
  Author-email: dev@qmenta.com
@@ -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=HQic19KCmO2lzCR22zKSZyIbxBryRgs2wWx9CoRKrgM,80034
4
+ qmenta/client/Project.py,sha256=eM6eT6H4d98ExWy-RWLdBbVO_QdW-AyML_Z8wZV5t0U,81881
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.dev1429.dist-info/METADATA,sha256=8UPEmMeW8-HeEXF2UmIL-A5F5HghF18xFyp57bmO8JM,672
9
- qmenta_client-1.1.dev1429.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
10
- qmenta_client-1.1.dev1429.dist-info/RECORD,,
8
+ qmenta_client-1.1.dev1436.dist-info/METADATA,sha256=Jh3CC_0kIS-G0S3doF1Y4Y3ZO7ds9uGJyFE1KElCX6s,672
9
+ qmenta_client-1.1.dev1436.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
10
+ qmenta_client-1.1.dev1436.dist-info/RECORD,,