scipion-pyworkflow 3.11.0__py3-none-any.whl → 3.11.1__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.
- pyworkflow/apps/__init__.py +29 -0
- pyworkflow/apps/pw_manager.py +37 -0
- pyworkflow/apps/pw_plot.py +51 -0
- pyworkflow/apps/pw_project.py +113 -0
- pyworkflow/apps/pw_protocol_list.py +143 -0
- pyworkflow/apps/pw_protocol_run.py +51 -0
- pyworkflow/apps/pw_run_tests.py +267 -0
- pyworkflow/apps/pw_schedule_run.py +322 -0
- pyworkflow/apps/pw_sleep.py +37 -0
- pyworkflow/apps/pw_sync_data.py +439 -0
- pyworkflow/apps/pw_viewer.py +78 -0
- pyworkflow/constants.py +1 -1
- pyworkflow/gui/__init__.py +36 -0
- pyworkflow/gui/browser.py +760 -0
- pyworkflow/gui/canvas.py +1190 -0
- pyworkflow/gui/dialog.py +979 -0
- pyworkflow/gui/form.py +2726 -0
- pyworkflow/gui/graph.py +247 -0
- pyworkflow/gui/graph_layout.py +271 -0
- pyworkflow/gui/gui.py +566 -0
- pyworkflow/gui/matplotlib_image.py +233 -0
- pyworkflow/gui/plotter.py +247 -0
- pyworkflow/gui/project/__init__.py +25 -0
- pyworkflow/gui/project/base.py +192 -0
- pyworkflow/gui/project/constants.py +139 -0
- pyworkflow/gui/project/labels.py +205 -0
- pyworkflow/gui/project/project.py +491 -0
- pyworkflow/gui/project/searchprotocol.py +238 -0
- pyworkflow/gui/project/searchrun.py +181 -0
- pyworkflow/gui/project/steps.py +171 -0
- pyworkflow/gui/project/utils.py +332 -0
- pyworkflow/gui/project/variables.py +179 -0
- pyworkflow/gui/project/viewdata.py +472 -0
- pyworkflow/gui/project/viewprojects.py +510 -0
- pyworkflow/gui/project/viewprotocols.py +2116 -0
- pyworkflow/gui/project/viewprotocols_extra.py +562 -0
- pyworkflow/gui/text.py +771 -0
- pyworkflow/gui/tooltip.py +185 -0
- pyworkflow/gui/tree.py +684 -0
- pyworkflow/gui/widgets.py +307 -0
- pyworkflow/mapper/__init__.py +26 -0
- pyworkflow/mapper/mapper.py +222 -0
- pyworkflow/mapper/sqlite.py +1581 -0
- pyworkflow/mapper/sqlite_db.py +145 -0
- pyworkflow/project/__init__.py +31 -0
- pyworkflow/project/config.py +454 -0
- pyworkflow/project/manager.py +180 -0
- pyworkflow/project/project.py +2095 -0
- pyworkflow/project/usage.py +165 -0
- pyworkflow/protocol/__init__.py +38 -0
- pyworkflow/protocol/bibtex.py +48 -0
- pyworkflow/protocol/constants.py +87 -0
- pyworkflow/protocol/executor.py +483 -0
- pyworkflow/protocol/hosts.py +317 -0
- pyworkflow/protocol/launch.py +277 -0
- pyworkflow/protocol/package.py +42 -0
- pyworkflow/protocol/params.py +781 -0
- pyworkflow/protocol/protocol.py +2707 -0
- pyworkflow/tests/__init__.py +29 -0
- pyworkflow/tests/test_utils.py +25 -0
- pyworkflow/tests/tests.py +341 -0
- pyworkflow/utils/__init__.py +38 -0
- pyworkflow/utils/dataset.py +414 -0
- pyworkflow/utils/echo.py +104 -0
- pyworkflow/utils/graph.py +169 -0
- pyworkflow/utils/log.py +293 -0
- pyworkflow/utils/path.py +528 -0
- pyworkflow/utils/process.py +153 -0
- pyworkflow/utils/profiler.py +92 -0
- pyworkflow/utils/progressbar.py +154 -0
- pyworkflow/utils/properties.py +617 -0
- pyworkflow/utils/reflection.py +129 -0
- pyworkflow/utils/utils.py +880 -0
- pyworkflow/utils/which.py +229 -0
- pyworkflow/webservices/__init__.py +8 -0
- pyworkflow/webservices/config.py +8 -0
- pyworkflow/webservices/notifier.py +152 -0
- pyworkflow/webservices/repository.py +59 -0
- pyworkflow/webservices/workflowhub.py +74 -0
- pyworkflowtests/tests/__init__.py +0 -0
- pyworkflowtests/tests/test_canvas.py +72 -0
- pyworkflowtests/tests/test_domain.py +45 -0
- pyworkflowtests/tests/test_logs.py +74 -0
- pyworkflowtests/tests/test_mappers.py +392 -0
- pyworkflowtests/tests/test_object.py +507 -0
- pyworkflowtests/tests/test_project.py +42 -0
- pyworkflowtests/tests/test_protocol_execution.py +146 -0
- pyworkflowtests/tests/test_protocol_export.py +78 -0
- pyworkflowtests/tests/test_protocol_output.py +158 -0
- pyworkflowtests/tests/test_streaming.py +47 -0
- pyworkflowtests/tests/test_utils.py +210 -0
- {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.1.dist-info}/METADATA +2 -2
- scipion_pyworkflow-3.11.1.dist-info/RECORD +161 -0
- scipion_pyworkflow-3.11.0.dist-info/RECORD +0 -71
- {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.1.dist-info}/WHEEL +0 -0
- {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.1.dist-info}/entry_points.txt +0 -0
- {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.1.dist-info}/licenses/LICENSE.txt +0 -0
- {scipion_pyworkflow-3.11.0.dist-info → scipion_pyworkflow-3.11.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,165 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# **************************************************************************
|
4
|
+
# *
|
5
|
+
# * Authors: Pablo Conesa [1]
|
6
|
+
# *
|
7
|
+
# * [1] Biocomputing unit, CNB-CSIC
|
8
|
+
# *
|
9
|
+
# * This program is free software: you can redistribute it and/or modify
|
10
|
+
# * it under the terms of the GNU General Public License as published by
|
11
|
+
# * the Free Software Foundation, either version 3 of the License, or
|
12
|
+
# * (at your option) any later version.
|
13
|
+
# *
|
14
|
+
# * This program is distributed in the hope that it will be useful,
|
15
|
+
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
+
# * GNU General Public License for more details.
|
18
|
+
# *
|
19
|
+
# * You should have received a copy of the GNU General Public License
|
20
|
+
# * along with this program. If not, see <https://www.gnu.org/licenses/>.
|
21
|
+
# *
|
22
|
+
# * All comments concerning this program package may be sent to the
|
23
|
+
# * e-mail address 'scipion@cnb.csic.es'
|
24
|
+
# *
|
25
|
+
# **************************************************************************
|
26
|
+
import json
|
27
|
+
import logging
|
28
|
+
logger = logging.getLogger(__name__)
|
29
|
+
|
30
|
+
from urllib.request import urlopen
|
31
|
+
from pyworkflow import Config
|
32
|
+
|
33
|
+
|
34
|
+
# Module to have Models for reporting usage data to the scipion.i2pc.es site.
|
35
|
+
class ProtStat:
|
36
|
+
""" Class to store the usage part of a reported ScipionWorkflow"""
|
37
|
+
def __init__(self, count=0, nextProtsDict=None):
|
38
|
+
self._count = count
|
39
|
+
self._nextProts = nextProtsDict or dict()
|
40
|
+
|
41
|
+
def getCount(self):
|
42
|
+
return self._count
|
43
|
+
def addUsage(self, count=1):
|
44
|
+
self._count += count
|
45
|
+
def addCountToNextProtocol(self, nextProt, count=1):
|
46
|
+
self._nextProts[nextProt] = self._nextProts.get(nextProt, 0) + count
|
47
|
+
|
48
|
+
def toJSON(self):
|
49
|
+
jsonStr = "[%s,{%s}]"
|
50
|
+
nextProtS = ""
|
51
|
+
|
52
|
+
if len(self._nextProts):
|
53
|
+
nextProtA = []
|
54
|
+
for protName, count in self._nextProts.items():
|
55
|
+
nextProtA.append('"%s":%d' % (protName, count))
|
56
|
+
|
57
|
+
nextProtS= ",".join(nextProtA)
|
58
|
+
|
59
|
+
jsonStr = jsonStr % (self._count, nextProtS)
|
60
|
+
|
61
|
+
return jsonStr
|
62
|
+
|
63
|
+
def __repr__(self):
|
64
|
+
return self.toJSON()
|
65
|
+
|
66
|
+
class ScipionWorkflow:
|
67
|
+
""" Class to serialize and deserialize what is reported from scipion.
|
68
|
+
Example: {"ProtA":
|
69
|
+
[2, {
|
70
|
+
"ProtB":2,
|
71
|
+
"ProtC":3,
|
72
|
+
...
|
73
|
+
}
|
74
|
+
], ...
|
75
|
+
}
|
76
|
+
"""
|
77
|
+
|
78
|
+
def __init__(self, jsonStr=None):
|
79
|
+
""" Instantiate this class optionally with a JSON string serialized from this class
|
80
|
+
(what is sent by Scipion to this web service)."""
|
81
|
+
|
82
|
+
self._prots = dict()
|
83
|
+
if jsonStr is not None:
|
84
|
+
self.deserialize(jsonStr)
|
85
|
+
|
86
|
+
def getProtStats(self):
|
87
|
+
return self._prots
|
88
|
+
|
89
|
+
def deserialize(self, jsonStr):
|
90
|
+
""" Deserialize a JSONString serialized by this class with the toJSON method"""
|
91
|
+
jsonObj = json.loads(jsonStr)
|
92
|
+
|
93
|
+
if isinstance(jsonObj, dict):
|
94
|
+
self.deserializeV2(jsonObj)
|
95
|
+
else:
|
96
|
+
self.deserializeList(jsonObj)
|
97
|
+
|
98
|
+
def deserializeV2(self, jsonObj):
|
99
|
+
""" Deserializes v2 usage stats: something like {"ProtA": [2,{..}],...} """
|
100
|
+
for key, value in jsonObj.items():
|
101
|
+
# Value should be something like [2,{..}]
|
102
|
+
count = value[0]
|
103
|
+
nextProtDict = value[1]
|
104
|
+
nextProt = ProtStat(count, nextProtDict)
|
105
|
+
self._prots[key] = nextProt
|
106
|
+
|
107
|
+
def deserializeList(self, jsonObj):
|
108
|
+
""" Deserializes old data: a list of protocol names repeated: ["ProtA","ProtA", "ProtB", ...] """
|
109
|
+
|
110
|
+
for protName in jsonObj:
|
111
|
+
self.addCount(protName)
|
112
|
+
|
113
|
+
def addCount(self, protName):
|
114
|
+
""" Adds one to the count of a protocol"""
|
115
|
+
|
116
|
+
protStat = self.getProtStat(protName)
|
117
|
+
|
118
|
+
protStat.addUsage()
|
119
|
+
|
120
|
+
def getProtStat(self, protName):
|
121
|
+
|
122
|
+
protStat = self._prots.get(protName, ProtStat())
|
123
|
+
if protName not in self._prots:
|
124
|
+
self._prots[protName] = protStat
|
125
|
+
|
126
|
+
return protStat
|
127
|
+
|
128
|
+
def addCountToNextProtocol(self, protName, nextProtName):
|
129
|
+
protStat = self.getProtStat(protName)
|
130
|
+
protStat.addCountToNextProtocol(nextProtName)
|
131
|
+
|
132
|
+
def getCount(self):
|
133
|
+
""" Returns the number of protocols in the workflow"""
|
134
|
+
count = 0
|
135
|
+
for ps in self._prots.values():
|
136
|
+
count += ps._count
|
137
|
+
return count
|
138
|
+
|
139
|
+
def toJSON(self):
|
140
|
+
""" Returns a valid JSON string"""
|
141
|
+
if len(self._prots) == 0:
|
142
|
+
return "{}"
|
143
|
+
else:
|
144
|
+
jsonStr="{"
|
145
|
+
for protName, protStat in self._prots.items():
|
146
|
+
|
147
|
+
jsonStr += '"%s":%s,' % (protName, protStat.toJSON())
|
148
|
+
|
149
|
+
jsonStr = jsonStr[:-1] + "}"
|
150
|
+
|
151
|
+
return jsonStr
|
152
|
+
|
153
|
+
def __repr__(self):
|
154
|
+
return self.toJSON()
|
155
|
+
|
156
|
+
def getNextProtocolSuggestions(protocol):
|
157
|
+
""" Returns the suggestions from the Scipion website for the next protocols to the protocol passed"""
|
158
|
+
|
159
|
+
try:
|
160
|
+
url = Config.SCIPION_STATS_SUGGESTION % protocol # protocol.getClassName()
|
161
|
+
results = json.loads(urlopen(url).read().decode('utf-8'))
|
162
|
+
return results
|
163
|
+
except Exception as e:
|
164
|
+
logger.error("Suggestions system not available", exc_info=e)
|
165
|
+
return []
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# **************************************************************************
|
2
|
+
# *
|
3
|
+
# * Authors: J.M. De la Rosa Trevin (jmdelarosa@cnb.csic.es)
|
4
|
+
# *
|
5
|
+
# * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
|
6
|
+
# *
|
7
|
+
# * This program is free software; you can redistribute it and/or modify
|
8
|
+
# * it under the terms of the GNU General Public License as published by
|
9
|
+
# * the Free Software Foundation; either version 3 of the License, or
|
10
|
+
# * (at your option) any later version.
|
11
|
+
# *
|
12
|
+
# * This program is distributed in the hope that it will be useful,
|
13
|
+
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# * GNU General Public License for more details.
|
16
|
+
# *
|
17
|
+
# * You should have received a copy of the GNU General Public License
|
18
|
+
# * along with this program; if not, write to the Free Software
|
19
|
+
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
20
|
+
# * 02111-1307 USA
|
21
|
+
# *
|
22
|
+
# * All comments concerning this program package may be sent to the
|
23
|
+
# * e-mail address 'scipion@cnb.csic.es'
|
24
|
+
# *
|
25
|
+
# **************************************************************************
|
26
|
+
"""
|
27
|
+
This modules contains classes required for the workflow
|
28
|
+
execution and tracking like: Step and Protocol
|
29
|
+
"""
|
30
|
+
|
31
|
+
from .protocol import *
|
32
|
+
from .executor import *
|
33
|
+
from .constants import *
|
34
|
+
from .params import *
|
35
|
+
|
36
|
+
from .launch import *
|
37
|
+
|
38
|
+
from .hosts import HostConfig
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# **************************************************************************
|
3
|
+
# *
|
4
|
+
# * Authors: Yaiza Rancel (cyrancel@cnb.csic.es)
|
5
|
+
# *
|
6
|
+
# * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
|
7
|
+
# *
|
8
|
+
# * This program is free software; you can redistribute it and/or modify
|
9
|
+
# * it under the terms of the GNU General Public License as published by
|
10
|
+
# * the Free Software Foundation; either version 3 of the License, or
|
11
|
+
# * (at your option) any later version.
|
12
|
+
# *
|
13
|
+
# * This program is distributed in the hope that it will be useful,
|
14
|
+
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# * GNU General Public License for more details.
|
17
|
+
# *
|
18
|
+
# * You should have received a copy of the GNU General Public License
|
19
|
+
# * along with this program; if not, write to the Free Software
|
20
|
+
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
21
|
+
# * 02111-1307 USA
|
22
|
+
# *
|
23
|
+
# * All comments concerning this program package may be sent to the
|
24
|
+
# * e-mail address 'scipion@cnb.csic.es'
|
25
|
+
# *
|
26
|
+
# **************************************************************************
|
27
|
+
"""
|
28
|
+
@article{delaRosaTrevin201693,
|
29
|
+
title = "Scipion: A software framework toward integration, reproducibility and validation in 3D electron microscopy ",
|
30
|
+
journal = "Journal of Structural Biology",
|
31
|
+
volume = "195",
|
32
|
+
number = "1",
|
33
|
+
pages = "93 - 99",
|
34
|
+
year = "2016",
|
35
|
+
note = "",
|
36
|
+
issn = "1047-8477",
|
37
|
+
doi = "http://doi.org/10.1016/j.jsb.2016.04.010",
|
38
|
+
url = "http://www.sciencedirect.com/science/article/pii/S104784771630079X",
|
39
|
+
author = "J.M. de la Rosa-Trevín and A. Quintana and L. del Cano and A. Zaldívar and I. Foche and J. Gutiérrez and J. Gómez-Blanco and J. Burguet-Castell and J. Cuenca-Alba and V. Abrishami and J. Vargas and J. Otón and G. Sharov and J.L. Vilas and J. Navas and P. Conesa and M. Kazemi and R. Marabini and C.O.S. Sorzano and J.M. Carazo",
|
40
|
+
keywords = "Electron microscopy",
|
41
|
+
keywords = "Single particle analysis",
|
42
|
+
keywords = "Image processing",
|
43
|
+
keywords = "Software package",
|
44
|
+
keywords = "Workflows",
|
45
|
+
keywords = "Reproducibility "
|
46
|
+
}
|
47
|
+
"""
|
48
|
+
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# **************************************************************************
|
2
|
+
# *
|
3
|
+
# * Authors: J.M. De la Rosa Trevin (jmdelarosa@cnb.csic.es)
|
4
|
+
# *
|
5
|
+
# * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC
|
6
|
+
# *
|
7
|
+
# * This program is free software; you can redistribute it and/or modify
|
8
|
+
# * it under the terms of the GNU General Public License as published by
|
9
|
+
# * the Free Software Foundation; either version 3 of the License, or
|
10
|
+
# * (at your option) any later version.
|
11
|
+
# *
|
12
|
+
# * This program is distributed in the hope that it will be useful,
|
13
|
+
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# * GNU General Public License for more details.
|
16
|
+
# *
|
17
|
+
# * You should have received a copy of the GNU General Public License
|
18
|
+
# * along with this program; if not, write to the Free Software
|
19
|
+
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
20
|
+
# * 02111-1307 USA
|
21
|
+
# *
|
22
|
+
# * All comments concerning this program package may be sent to the
|
23
|
+
# * e-mail address 'scipion@cnb.csic.es'
|
24
|
+
# *
|
25
|
+
# **************************************************************************
|
26
|
+
"""
|
27
|
+
This modules contains classes required for the workflow
|
28
|
+
execution and tracking like: Step and Protocol
|
29
|
+
"""
|
30
|
+
|
31
|
+
# ------------------ Constants values -----------------------------------------
|
32
|
+
|
33
|
+
# Possible status of a protocol run, used mainly to monitor progress
|
34
|
+
|
35
|
+
STATUS_SAVED = "saved" # Parameters saved for later use
|
36
|
+
STATUS_LAUNCHED = "launched" # launched to queue system, only useful for protocols
|
37
|
+
STATUS_NEW = "new"
|
38
|
+
STATUS_RUNNING = "running" # currently executing
|
39
|
+
STATUS_FAILED = "failed" # it run and failed
|
40
|
+
STATUS_FINISHED = "finished" # successfully finished
|
41
|
+
STATUS_ABORTED = "aborted"
|
42
|
+
STATUS_INTERACTIVE = "interactive" # waiting for user interaction
|
43
|
+
STATUS_WAITING = "waiting" # following status is used for streaming only
|
44
|
+
# Allow to schedule jobs not ready for running yet
|
45
|
+
STATUS_SCHEDULED = "scheduled"
|
46
|
+
|
47
|
+
ACTIVE_STATUS = [STATUS_LAUNCHED, STATUS_RUNNING, STATUS_INTERACTIVE,
|
48
|
+
STATUS_SCHEDULED]
|
49
|
+
|
50
|
+
# Execution modes
|
51
|
+
MODE_RESUME = 0 # Try to starting at the first changed step, skipping unchanged ones
|
52
|
+
MODE_RESTART = 1 # Restart the protocol from the beginning, deleting all previous results
|
53
|
+
MODE_CONTINUE = 2 # Continue from specific step, not widely used //DEPRECATED.
|
54
|
+
# JMRT: We now use 'Continue' label instead of 'Resume' which is more intuitive for users.
|
55
|
+
MODE_CHOICES = ('Continue', 'Restart') # , 'Continue')
|
56
|
+
|
57
|
+
# Initial sleeping time (in seconds) in order to launch a scheduled protocol.
|
58
|
+
# This value is multiply to the protocol level into the workflow.
|
59
|
+
INITIAL_SLEEP_TIME = 30
|
60
|
+
|
61
|
+
# Maximum time (in seconds) waiting for a scheduled protocol to check if it
|
62
|
+
# can be launched.
|
63
|
+
MAX_SLEEP_TIME = 120
|
64
|
+
|
65
|
+
|
66
|
+
# Steps execution mode
|
67
|
+
STEPS_SERIAL = 0 # Execute steps serially, some of the steps can be mpi programs
|
68
|
+
STEPS_PARALLEL = 1 # Execute steps in parallel through threads
|
69
|
+
|
70
|
+
# Level of expertise for the input parameters, mainly used in the protocol form
|
71
|
+
LEVEL_NORMAL = 0
|
72
|
+
LEVEL_ADVANCED = 1
|
73
|
+
LEVEL_CHOICES = ('Normal', 'Advanced')
|
74
|
+
|
75
|
+
# Param names for GPU processing
|
76
|
+
USE_GPU = 'useGpu'
|
77
|
+
GPU_LIST = 'gpuList'
|
78
|
+
VOID_GPU = 99
|
79
|
+
|
80
|
+
# Job management
|
81
|
+
UNKNOWN_JOBID = -1
|
82
|
+
|
83
|
+
# File sizes
|
84
|
+
SIZE_1KB = 1024
|
85
|
+
SIZE_1MB = SIZE_1KB * SIZE_1KB
|
86
|
+
SIZE_1GB = SIZE_1MB * SIZE_1KB
|
87
|
+
SIZE_1TB = SIZE_1GB * SIZE_1KB
|