processview 0.1.1b0__tar.gz → 0.1.2__tar.gz

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.
Files changed (22) hide show
  1. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/__pycache__/version.cpython-37.pyc +0 -0
  2. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/core/__pycache__/superviseprocess.cpython-37.pyc +0 -0
  3. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/core/manager/__pycache__/manager.cpython-37.pyc +0 -0
  4. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/core/manager/manager.py +1 -1
  5. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/core/manager/test/__pycache__/test_manager.cpython-37.pyc +0 -0
  6. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/core/manager/test/test_manager.py +21 -2
  7. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/core/superviseprocess.py +7 -0
  8. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/gui/__pycache__/processmanager.cpython-37.pyc +0 -0
  9. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/gui/processmanager.py +0 -2
  10. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/gui/test/__init__.py +38 -0
  11. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/gui/test/__pycache__/__init__.cpython-37.pyc +0 -0
  12. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/gui/test/__pycache__/test_process_manager.cpython-37.pyc +0 -0
  13. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/gui/test/test_process_manager.py +108 -0
  14. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/test/__init__.py +2 -0
  15. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/test/__pycache__/__init__.cpython-37.pyc +0 -0
  16. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/processview/version.py +3 -3
  17. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/{processview-0.1.1b0-py3.7.egg-info → processview-0.1.2-py3.7.egg-info}/PKG-INFO +1 -1
  18. home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/{processview-0.1.1b0-py3.7.egg-info → processview-0.1.2-py3.7.egg-info}/SOURCES.txt +2 -0
  19. /home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/{processview-0.1.1b0-py3.7.egg-info → processview-0.1.2-py3.7.egg-info}/dependency_links.txt +0 -0
  20. /home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/{processview-0.1.1b0-py3.7.egg-info → processview-0.1.2-py3.7.egg-info}/not-zip-safe +0 -0
  21. /home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/{processview-0.1.1b0-py3.7.egg-info → processview-0.1.2-py3.7.egg-info}/requires.txt +0 -0
  22. /home/payno/.local/share/virtualenvs/tomwer_venv/lib/python3.7/site-packages/{processview-0.1.1b0-py3.7.egg-info → processview-0.1.2-py3.7.egg-info}/top_level.txt +0 -0
@@ -126,7 +126,7 @@ class ProcessManager:
126
126
 
127
127
  :param BaseProcess process:
128
128
  """
129
- if process.process_id in self._processes:
129
+ if process.process_id in self._processes and process.is_master_process:
130
130
  del self._processes[process.process_id]
131
131
 
132
132
  def get_processes(self) -> tuple:
@@ -33,6 +33,7 @@ from processview.core.superviseprocess import SuperviseProcess
33
33
  from processview.core.manager import ProcessManager
34
34
  from processview.core.manager import DatasetState
35
35
  from processview.core.dataset import Dataset
36
+ from processview.core.dataset import DatasetIdentifier
36
37
  import gc
37
38
 
38
39
 
@@ -99,7 +100,10 @@ class TestProcessManager(unittest.TestCase):
99
100
  # test 'getProcessHistory'
100
101
  self.assertEqual(
101
102
  manager.get_process_history(process=p1),
102
- ((str(scan_1), DatasetState.PENDING), (str(scan_2), DatasetState.SUCCEED)),
103
+ (
104
+ (scan_1.get_dataset_identifier(), DatasetState.PENDING),
105
+ (scan_2.get_dataset_identifier(), DatasetState.SUCCEED),
106
+ ),
103
107
  )
104
108
 
105
109
 
@@ -111,9 +115,24 @@ class _DummyScan(Dataset):
111
115
  def __str__(self) -> str:
112
116
  return self.name
113
117
 
114
- def short_str(self):
118
+ def get_dataset_identifier(self) -> DatasetIdentifier:
119
+ return _DummyIdentifier(self)
120
+
121
+
122
+ class _DummyIdentifier(DatasetIdentifier):
123
+ def __init__(self, dataset):
124
+ super().__init__(dataset)
125
+ self.name = dataset.name
126
+
127
+ def __str__(self):
115
128
  return self.name
116
129
 
130
+ def __eq__(self, other):
131
+ return self.name == other.name
132
+
133
+ def __hash__(self):
134
+ return hash(self.name)
135
+
117
136
 
118
137
  def suite():
119
138
  test_suite = unittest.TestSuite()
@@ -63,6 +63,9 @@ class SuperviseProcess:
63
63
 
64
64
  def __init__(self, name=None, process_id=None):
65
65
  self._name = name
66
+ self._is_master_process = process_id is None
67
+ """is this process the master process of the SuperviseProcess. Or is
68
+ it just one of the underlying process of a master SuperviseProcess"""
66
69
  if process_id is None:
67
70
  ProcessManager().register(self)
68
71
  else:
@@ -71,6 +74,10 @@ class SuperviseProcess:
71
74
  def __del__(self):
72
75
  ProcessManager().unregister(self)
73
76
 
77
+ @property
78
+ def is_master_process(self):
79
+ return self._is_master_process
80
+
74
81
  @property
75
82
  def process_id(self):
76
83
  return self.__process_id
@@ -90,8 +90,6 @@ class ObservationTable(qt.QTableView):
90
90
  def contextMenuEvent(self, event):
91
91
  process = self._processAt(event.pos().x())
92
92
  dataset = self._datasetAt(event.pos().y())
93
- print("process is", process)
94
- print("data is", dataset)
95
93
  if _ProcessManager().met(process=process, dataset=dataset):
96
94
  self._target = (process, dataset)
97
95
  self.menu.exec_(event.globalPos())
@@ -0,0 +1,38 @@
1
+ # coding: utf-8
2
+ # /*##########################################################################
3
+ #
4
+ # Copyright (c) 2017 European Synchrotron Radiation Facility
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ # THE SOFTWARE.
23
+ #
24
+ # ###########################################################################*/
25
+
26
+ __authors__ = ["H.Payno"]
27
+ __license__ = "MIT"
28
+ __date__ = "01/02/2021"
29
+
30
+ import unittest
31
+
32
+ from .test_process_manager import suite as test_process_manager_suite
33
+
34
+
35
+ def suite():
36
+ test_suite = unittest.TestSuite()
37
+ test_suite.addTest(test_process_manager_suite())
38
+ return test_suite
@@ -0,0 +1,108 @@
1
+ # coding: utf-8
2
+ # /*##########################################################################
3
+ #
4
+ # Copyright (c) 2016-2017 European Synchrotron Radiation Facility
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ # THE SOFTWARE.
23
+ #
24
+ # ###########################################################################*/
25
+
26
+ __authors__ = ["H. Payno"]
27
+ __license__ = "MIT"
28
+ __date__ = "02/11/2020"
29
+
30
+
31
+ import unittest
32
+ from processview.core.superviseprocess import SuperviseProcess
33
+ from processview.core.dataset import Dataset
34
+ from processview.core.dataset import DatasetIdentifier
35
+ from processview.gui.processmanager import ProcessManager
36
+ from processview.core.manager import DatasetState
37
+ from silx.gui.utils.testutils import SignalListener
38
+ from silx.gui.utils.testutils import TestCaseQt
39
+ import gc
40
+
41
+
42
+ class TestProcessManager(TestCaseQt):
43
+ """
44
+ test ProcessManager
45
+ """
46
+
47
+ def setUp(self):
48
+ TestCaseQt.setUp(self)
49
+ self.signalListener = SignalListener()
50
+ self.manager = ProcessManager()
51
+ self.manager.sigUpdated.connect(self.signalListener)
52
+
53
+ def tearDown(self):
54
+ self.signalListener = None
55
+ self.processManager = None
56
+ gc.collect()
57
+ TestCaseQt.tearDown(self)
58
+
59
+ def testProcessStatesUpdate(self):
60
+ """insure providing states works well"""
61
+ p1 = SuperviseProcess()
62
+ p2 = SuperviseProcess()
63
+ scan_1 = _DummyScan("scan1")
64
+ scan_2 = _DummyScan("scan2")
65
+ self.manager.notify_dataset_state(
66
+ dataset=scan_1, state=DatasetState.PENDING, process=p1
67
+ )
68
+ self.manager.notify_dataset_state(
69
+ dataset=scan_2, state=DatasetState.SUCCEED, process=p1
70
+ )
71
+ self.manager.notify_dataset_state(
72
+ dataset=scan_2, state=DatasetState.FAILED, process=p2
73
+ )
74
+ self.assertEqual(self.signalListener.callCount(), 3)
75
+
76
+
77
+ class _DummyScan(Dataset):
78
+ def __init__(self, name):
79
+ super().__init__()
80
+ self.name = name
81
+
82
+ def __str__(self) -> str:
83
+ return self.name
84
+
85
+ def get_dataset_identifier(self) -> DatasetIdentifier:
86
+ return _DummyIdentifier(self)
87
+
88
+
89
+ class _DummyIdentifier(DatasetIdentifier):
90
+ def __init__(self, dataset):
91
+ super().__init__(dataset)
92
+ self.name = dataset.name
93
+
94
+ def __str__(self):
95
+ return self.name
96
+
97
+ def __eq__(self, other):
98
+ return self.name == other.name
99
+
100
+ def __hash__(self):
101
+ return hash(self.name)
102
+
103
+
104
+ def suite():
105
+ test_suite = unittest.TestSuite()
106
+ for ui in (TestProcessManager,):
107
+ test_suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ui))
108
+ return test_suite
@@ -30,11 +30,13 @@ __date__ = "29/01/2021"
30
30
 
31
31
  import unittest
32
32
  from ..core import test as test_core
33
+ from ..gui import test as test_gui
33
34
 
34
35
 
35
36
  def suite(loader=None):
36
37
  test_suite = unittest.TestSuite()
37
38
  test_suite.addTest(test_core.suite())
39
+ test_suite.addTest(test_gui.suite())
38
40
 
39
41
  return test_suite
40
42
 
@@ -77,9 +77,9 @@ RELEASE_LEVEL_VALUE = {
77
77
 
78
78
  MAJOR = 0
79
79
  MINOR = 1
80
- MICRO = 1
81
- RELEV = "rc" # <16
82
- SERIAL = 0 # <16
80
+ MICRO = 2
81
+ RELEV = "final" # <16
82
+ SERIAL = 1 # <16
83
83
 
84
84
  date = __date__
85
85
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: processview
3
- Version: 0.1.1b0
3
+ Version: 0.1.2
4
4
  Summary: Library workflow process supervision
5
5
  Home-page: https://gitlab.esrf.fr/workflow/processview
6
6
  Author: data analysis unit
@@ -21,6 +21,8 @@ processview/core/test/__init__.py
21
21
  processview/gui/__init__.py
22
22
  processview/gui/icons.py
23
23
  processview/gui/processmanager.py
24
+ processview/gui/test/__init__.py
25
+ processview/gui/test/test_process_manager.py
24
26
  processview/resources/__init__.py
25
27
  processview/resources/gui/icons/advancement.png
26
28
  processview/resources/gui/icons/advancement.svg