Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ jobs:
# Run linter / checks
checks:
uses: ewoks-kit/.github/.github/workflows/python-check.yml@main
with:
enable-black: "false"
enable-flake8: "false"
enable-isort: "false"
enable-ruff: "true"

# Build documentation
docs:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
!.gitignore
!.github
!.readthedocs.yaml
!.flake8

# Byte / compiled / optimized
*.py[cod]
Expand Down
25 changes: 20 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ test = [
]
dev = [
"ewoksppf[test]",
"black >=25",
"flake8 >=4",
"ruff>=0.16.0",
]
doc = [
"ewoksppf[test]",
Expand All @@ -57,6 +56,22 @@ omit = ['*/tests/*']
[project.entry-points."ewoks.engines"]
"ppf" = "ewoksppf.engine:PpfWorkflowEngine"

[tool.isort]
profile = "black"
force_single_line = "True"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"F", # pyflakes
"I", # isort
"S", # flake8-bandit
]
ignore = [
"E501", # line too long
]

[tool.ruff.lint.per-file-ignores]
"src/ewoksppf/tests/*.py" = [
"S101" # allow asserts
]

[tool.ruff.lint.isort]
force-single-line = true
known-first-party = ["ewoksppf"]
13 changes: 6 additions & 7 deletions scripts/mapreduce_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@
"""

import os
import random
import time
from random import SystemRandom

import numpy
from ewokscore.task import Task
from silx.io import h5py_utils

from ewoksppf import execute_graph

_random = SystemRandom()


class GenerateData(
Task,
input_names=["nblocks", "block_size"],
optional_input_names=["block_index"],
output_names=["image_stack", "block_index", "finished"],
):

def run(self):
t0 = time.perf_counter()
block_index = self.get_input_value("block_index", 0)
Expand All @@ -34,7 +35,7 @@ def run(self):
self.outputs.block_index = block_index + 1
self.outputs.finished = self.outputs.block_index >= self.inputs.nblocks
t1 = time.perf_counter()
print(f"{block_size/(t1-t0)} images/sec")
print(f"{block_size / (t1 - t0)} images/sec")


class IntegrateData(
Expand All @@ -43,25 +44,23 @@ class IntegrateData(
optional_input_names=["axis", "delay"],
output_names=["pattern_stack", "block_index"],
):

def run(self):
image_axis = self.get_input_value("axis", 0)
self.outputs.pattern_stack = self.inputs.image_stack.sum(axis=image_axis + 1)
self.outputs.block_index = self.inputs.block_index

delay = self.get_input_value("delay", 0)
if delay:
time.sleep(random.uniform(delay, delay * 1.5))
time.sleep(_random.uniform(delay, delay * 1.5))
else:
time.sleep(random.uniform(0, 0.1))
time.sleep(_random.uniform(0, 0.1))


class SaveData(
Task,
input_names=["data_stack", "block_index", "filename"],
output_names=["hdf5_url"],
):

def run(self):
filename = os.path.abspath(self.inputs.filename)
block_index = self.inputs.block_index
Expand Down
1 change: 0 additions & 1 deletion src/ewoksppf/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class PpfWorkflowEngine(WorkflowEngine):

def execute_graph(
self,
graph: Any,
Expand Down
Loading