qmenta-client 1.1.dev1410__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
@@ -1486,7 +1486,8 @@ class Project:
1486
1486
  analysis_name_or_id = int(analysis_name_or_id)
1487
1487
  else:
1488
1488
  search_tag = "p_n"
1489
- excluded_characters = ["\\", "[", "(", "+", "*"]
1489
+ excluded_characters = ["\\", "[", "]", "(", ")",
1490
+ "{", "}", "+", "*"]
1490
1491
  excluded_bool = [character in analysis_name_or_id for character in excluded_characters]
1491
1492
  if any(excluded_bool):
1492
1493
  raise Exception(f"p_n does not allow characters {excluded_characters}")
@@ -1536,7 +1537,7 @@ class Project:
1536
1537
  - secret_name: str or None Subject ID
1537
1538
  - tags: str or None
1538
1539
  - with_child_analysis: 1 or None if 1, child analysis of workflows will appear
1539
- - id: str or None ID
1540
+ - id: int or None ID
1540
1541
  - state: running, completed, pending, exception or None
1541
1542
  - username: str or None
1542
1543
 
@@ -1570,7 +1571,8 @@ class Project:
1570
1571
  if not isinstance(search_condition[key], search_keys[key]) and search_condition[key] is not None:
1571
1572
  raise Exception((f"The key {key} in the search condition" f"is not type {search_keys[key]}"))
1572
1573
  if "p_n" == key:
1573
- excluded_characters = ["\\", "[", "(", "+", "*"]
1574
+ excluded_characters = ["\\", "[", "]", "(", ")",
1575
+ "{", "}", "+", "*"]
1574
1576
  excluded_bool = [character in search_condition["p_n"] for character in excluded_characters]
1575
1577
  if any(excluded_bool):
1576
1578
  raise Exception(f"p_n does not allow characters {excluded_characters}")
@@ -1691,6 +1693,57 @@ class Project:
1691
1693
 
1692
1694
  return True
1693
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
+
1694
1747
  """ QC Status Related Methods """
1695
1748
 
1696
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.dev1410
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=tr6_mKCt4hDA5Y8d24V1U3mZBq5_O86Y9TRQbOfLiM8,79916
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.dev1410.dist-info/METADATA,sha256=kVwivj32iCexGnLGS8ADbJaNbvs-iU3K6iYioJvqAzg,672
9
- qmenta_client-1.1.dev1410.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
10
- qmenta_client-1.1.dev1410.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,,