scipion-pyworkflow 3.10.0__py3-none-any.whl → 3.10.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/constants.py CHANGED
@@ -43,7 +43,7 @@ VERSION_1 = '1.0.0'
43
43
  VERSION_1_1 = '1.1.0'
44
44
  VERSION_1_2 = '1.2.0'
45
45
  VERSION_2_0 = '2.0.0'
46
- VERSION_3_0 = '3.10.0'
46
+ VERSION_3_0 = '3.10.1'
47
47
 
48
48
  # For a new release, define a new constant and assign it to LAST_VERSION
49
49
  # The existing one has to be added to OLD_VERSIONS list.
@@ -144,9 +144,9 @@ class StepExecutor:
144
144
 
145
145
  class StepThread(threading.Thread):
146
146
  """ Thread to run Steps in parallel. """
147
- def __init__(self, thId, step, lock):
147
+ def __init__(self, step, lock):
148
148
  threading.Thread.__init__(self)
149
- self.thId = thId
149
+ self.thId = step.getObjId()
150
150
  self.step = step
151
151
  self.lock = lock
152
152
 
@@ -262,7 +262,7 @@ class ThreadStepExecutor(StepExecutor):
262
262
  return []
263
263
  else:
264
264
  return gpus
265
- def getFreeGpuSlot(self, nodeId=None):
265
+ def getFreeGpuSlot(self, stepId=None):
266
266
  """ Returns a free gpu slot available or None. If node is passed it also reserves it for that node
267
267
 
268
268
  :param node: node to make the reserve of Gpus
@@ -272,10 +272,10 @@ class ThreadStepExecutor(StepExecutor):
272
272
  if node < 0:
273
273
  gpus = self.gpuDict[node]
274
274
 
275
- if nodeId is not None:
275
+ if stepId is not None:
276
276
  self.gpuDict.pop(node)
277
- self.gpuDict[nodeId] = gpus
278
- logger.info("GPUs %s assigned to thread %s" % (gpus, nodeId))
277
+ self.gpuDict[stepId] = gpus
278
+ logger.info("GPUs %s assigned to step %s" % (gpus, stepId))
279
279
  else:
280
280
  logger.info("Free gpu slot found at %s" % node)
281
281
  return gpus
@@ -288,14 +288,14 @@ class ThreadStepExecutor(StepExecutor):
288
288
  if gpus is not None:
289
289
  self.gpuDict.pop(node)
290
290
  self.gpuDict[-node-1] = gpus
291
- logger.info("GPUs %s freed from thread %s" % (gpus, node))
291
+ logger.info("GPUs %s freed from step %s" % (gpus, node))
292
292
  else:
293
- logger.debug("node %s not found in GPU slots" % node)
293
+ logger.debug("step id %s not found in GPU slots" % node)
294
294
 
295
295
  def _isStepRunnable(self, step):
296
296
  """ Overwrite this method to check GPUs availability"""
297
297
 
298
- if self.gpuList and step.needsGPU() and self.getFreeGpuSlot() is None:
298
+ if self.gpuList and step.needsGPU() and self.getFreeGpuSlot(step.getObjId()) is None:
299
299
  logger.info("Can't run step %s. Needs gpus and there are no free gpu slots" % step)
300
300
  return False
301
301
 
@@ -361,7 +361,7 @@ class ThreadStepExecutor(StepExecutor):
361
361
  node = freeNodes.pop(0) # take an available node
362
362
  runningSteps[node] = step
363
363
  logger.debug("Running step %s on node %s" % (step, node))
364
- t = StepThread(node, step, sharedLock)
364
+ t = StepThread(step, sharedLock)
365
365
  # won't keep process up if main thread ends
366
366
  t.daemon = True
367
367
  t.start()
@@ -362,6 +362,18 @@ class Protocol(Step):
362
362
  # prerequisites of steps, but is easier to keep it
363
363
  stepsExecutionMode = STEPS_SERIAL
364
364
 
365
+ @classmethod
366
+ def modeSerial(cls):
367
+ """ Returns true if steps are run one after another"""
368
+ # Maybe this property can be inferred from the
369
+ # prerequisites of steps, but is easier to keep it
370
+ return cls.stepsExecutionMode == STEPS_SERIAL
371
+
372
+ @classmethod
373
+ def modeParallel(cls):
374
+ """ Returns true if steps are run in parallel"""
375
+ return not cls.modeSerial()
376
+
365
377
  def __init__(self, **kwargs):
366
378
  Step.__init__(self, **kwargs)
367
379
  self._size = None
@@ -1316,7 +1328,7 @@ class Protocol(Step):
1316
1328
  prot_id=self.getObjId(),
1317
1329
  prot_name=self.getClassName(),
1318
1330
  step_id=step._index))
1319
- if step.isFailed() and self.stepsExecutionMode == STEPS_PARALLEL:
1331
+ if step.isFailed() and self.modeParallel():
1320
1332
  # In parallel mode the executor will exit to close
1321
1333
  # all working threads, so we need to close
1322
1334
  self._endRun()
@@ -2434,7 +2446,7 @@ def runProtocolMain(projectPath, protDbPath, protId):
2434
2446
  executor = None
2435
2447
  nThreads = max(protocol.numberOfThreads.get(), 1)
2436
2448
 
2437
- if protocol.stepsExecutionMode == STEPS_PARALLEL and nThreads > 1:
2449
+ if protocol.modeParallel() and nThreads > 1:
2438
2450
  if protocol.useQueueForSteps():
2439
2451
  executor = QueueStepExecutor(hostConfig,
2440
2452
  protocol.getSubmitDict(),
@@ -2531,10 +2543,7 @@ class ProtStreamingBase(Protocol):
2531
2543
  Minimum number of threads is 3 and should run in parallel mode.
2532
2544
  """
2533
2545
 
2534
- def __init__(self, **kwargs):
2535
-
2536
- super().__init__()
2537
- self.stepsExecutionMode = STEPS_PARALLEL
2546
+ stepsExecutionMode = STEPS_PARALLEL
2538
2547
  def _insertAllSteps(self):
2539
2548
  # Insert the step that generates the steps
2540
2549
  self._insertFunctionStep(self.resumableStepGeneratorStep, str(datetime.now()), needsGPU=False)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scipion-pyworkflow
3
- Version: 3.10.0
3
+ Version: 3.10.1
4
4
  Summary: Simple workflow platform used in scientific applications, initially developed within the Scipion framework for image processing in Electron Microscopy.
5
5
  Home-page: https://github.com/scipion-em/scipion-pyworkflow
6
6
  Author: J.M. De la Rosa Trevin, Roberto Marabini, Grigory Sharov, Josue Gomez Blanco, Pablo Conesa, Yunior Fonseca Reyna
@@ -1,6 +1,6 @@
1
1
  pyworkflow/__init__.py,sha256=Wr-MVKMQJy_Cy-rpPPB0-pyv8-8tx7GPPaLSNBrV1AI,1246
2
2
  pyworkflow/config.py,sha256=_sq6YCRfcfE4WUNXLShgbICbBeTSLpD2KmPVapR1Wos,22306
3
- pyworkflow/constants.py,sha256=R9MnxV0n3oPb4pwacP6L80gj6inmkuP7yMS572s6OHQ,7448
3
+ pyworkflow/constants.py,sha256=y5mtef1j-asVkv2s0owbC0DSDwbbd4Vtxv_ToMdoNJ8,7448
4
4
  pyworkflow/exceptions.py,sha256=3VFxuNJHcIWxRnLPR0vYg0RFAQMmxPBJZLZSi87VI8E,507
5
5
  pyworkflow/object.py,sha256=yX3tBUuBssCI8aWGlTmyEKzFE59dJq_7NqllouVzMk0,55069
6
6
  pyworkflow/plugin.py,sha256=JJm5plPyOnPAR4To6I5rXVIBda-1Dg-53zicdnLSrac,28858
@@ -67,12 +67,12 @@ pyworkflow/project/scripts/stop.py,sha256=vCeCxkwPCoUkLbna5HCxKWJ1hrsI4U19Sg9JD4
67
67
  pyworkflow/protocol/__init__.py,sha256=bAdIpvUW4GAYdIuv92DZ44-OEkZ7lTtnp1S9T5cwtVs,1413
68
68
  pyworkflow/protocol/bibtex.py,sha256=mCUk1Hp5Vp_i2lozDM1BQNOw10e_RSu86oXvrR63sOA,2122
69
69
  pyworkflow/protocol/constants.py,sha256=DfuCs7eub-mLHJjEpHlIG9BW3fUpRwfTVwMYytNWv6U,3392
70
- pyworkflow/protocol/executor.py,sha256=OxnRGZeJI8vYJ6ZfSWifN043pvdw1vV_x9sjQd57fi8,17745
70
+ pyworkflow/protocol/executor.py,sha256=tLqMm4Bmr8G8Ni4oNidCHG9oswHAwvfORABQe3F3u-w,17758
71
71
  pyworkflow/protocol/hosts.py,sha256=B9ENNclqYe75CPqAMOoPjwn-r3ST6HxTewXtsK_zWks,10453
72
72
  pyworkflow/protocol/launch.py,sha256=7WKAiHma2tSuhqK4xVnxD_SnVt7Y5qyDFdQwTo8BLF0,11267
73
73
  pyworkflow/protocol/package.py,sha256=L6x3HHKtbrhDQRJHD07SG3DQKNMGaRQ0ROoLEY3SuRQ,1444
74
74
  pyworkflow/protocol/params.py,sha256=gP6QImgULvzCr-f0iseArIp1bjXm1JuUr9padmuMs7M,25901
75
- pyworkflow/protocol/protocol.py,sha256=pwgaQzcnuJOkpBDJ8k7ZEc0DJ6m_BrZz627HvWZoW2E,97145
75
+ pyworkflow/protocol/protocol.py,sha256=K-srKr4D220JLwYcDfAAlfBsAvrqf55gnyCZsSTt3uc,97442
76
76
  pyworkflow/resources/Imagej.png,sha256=nU2nWI1wxZB_xlOKsZzdUjj-qiCTjO6GwEKYgZ5Risg,14480
77
77
  pyworkflow/resources/chimera.png,sha256=AKCuwMqmZo0Cg2sddMUjBWUhmAq-nPsAVCBpVrYNeiQ,815
78
78
  pyworkflow/resources/fa-exclamation-triangle_alert.png,sha256=31_XvRu0CkJ2dvHSpcBAR43378lIJTWwiag_A7SuUQc,585
@@ -131,10 +131,10 @@ pyworkflowtests/tests/test_protocol_export.py,sha256=z18nKPkOnrYLMU8KqcnVsF6-ylQ
131
131
  pyworkflowtests/tests/test_protocol_output.py,sha256=8gnIFMRNmwPnIBRCG29WHJB6mqK4FLGn1jiXHtTD6pY,5980
132
132
  pyworkflowtests/tests/test_streaming.py,sha256=vOH-bKCM-fVUSsejqNnCX5TPXhdUayk9ZtJHsNVcfCY,1615
133
133
  pyworkflowtests/tests/test_utils.py,sha256=_pTYGCuXC7YNMdCBzUYNfSBCR3etrHsxHfIhsQi4VPc,7465
134
- scipion_pyworkflow-3.10.0.dist-info/LICENSE.txt,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
135
- scipion_pyworkflow-3.10.0.dist-info/METADATA,sha256=VMXHL5VKBHV-p3EyaKLc1yk_E7tUVSUkH2bQSBnLX7w,4682
136
- scipion_pyworkflow-3.10.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
137
- scipion_pyworkflow-3.10.0.dist-info/dependency_links.txt,sha256=D7r_CPRjYRtBb3q_OBocTdsaeXI5TwnYMu5ri0JFtzs,84
138
- scipion_pyworkflow-3.10.0.dist-info/entry_points.txt,sha256=oR-zwsOICjEPINm-FWVPp-RfnpXZanVal4_XG6BWkkQ,127
139
- scipion_pyworkflow-3.10.0.dist-info/top_level.txt,sha256=PzyJteyenJwLjAeSFP7oYrTN_U71GABQwET8oLZkh9k,27
140
- scipion_pyworkflow-3.10.0.dist-info/RECORD,,
134
+ scipion_pyworkflow-3.10.1.dist-info/LICENSE.txt,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
135
+ scipion_pyworkflow-3.10.1.dist-info/METADATA,sha256=hzV_49aH0z8vvHf3pNd0kAK7e8YQNpVyg4-H-hO-LeA,4682
136
+ scipion_pyworkflow-3.10.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
137
+ scipion_pyworkflow-3.10.1.dist-info/dependency_links.txt,sha256=D7r_CPRjYRtBb3q_OBocTdsaeXI5TwnYMu5ri0JFtzs,84
138
+ scipion_pyworkflow-3.10.1.dist-info/entry_points.txt,sha256=oR-zwsOICjEPINm-FWVPp-RfnpXZanVal4_XG6BWkkQ,127
139
+ scipion_pyworkflow-3.10.1.dist-info/top_level.txt,sha256=PzyJteyenJwLjAeSFP7oYrTN_U71GABQwET8oLZkh9k,27
140
+ scipion_pyworkflow-3.10.1.dist-info/RECORD,,