Skip to content

Commit

Permalink
add taskvine test
Browse files Browse the repository at this point in the history
  • Loading branch information
btovar committed Mar 5, 2025
1 parent 0adc4a2 commit 48e6bb9
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,30 @@ jobs:
conda-pack --output coffea-env.tar.gz
python wq.py coffea-env.tar.gz
testtaskvine:
runs-on: ubuntu-latest
timeout-minutes: 15
needs: pre-commit
strategy:
matrix:
python-version: ["3.11"]
name: test coffea-taskvine

steps:
- uses: actions/checkout@v3
- name: Set up Conda
uses: conda-incubator/[email protected]
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Test TaskVine Executor
shell: bash -l {0}
run: |
conda create --yes --name coffea-env -c conda-forge python=${{ matrix.python-version }} ndcctools pytest 'setuptools<71'
conda activate coffea-env
python -m pip install --ignore-installed .
python -m pytest tests/test_taskvine_executor.py
# testskyhookjob:
# runs-on: ubuntu-latest
Expand Down
49 changes: 49 additions & 0 deletions tests/test_taskvine_executor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import sys
import os.path as osp
import pytest
from coffea import processor
import ndcctools.taskvine as vine

if sys.platform.startswith("win"):
pytest.skip("skipping tests that only function in linux", allow_module_level=True)


def test_taskvine_executor_nanoevents_analysis():
from coffea.processor.test_items import NanoEventsProcessor

filelist = {
"ZJets": {
"treename": "Events",
"files": [osp.abspath("tests/samples/nano_dy.root")],
"metadata": {"checkusermeta": True, "someusermeta": "hello"},
},
"Data": {
"treename": "Events",
"files": [osp.abspath("tests/samples/nano_dimuon.root")],
"metadata": {"checkusermeta": True, "someusermeta2": "world"},
},
}

port = 9123
executor = processor.TaskVineExecutor(port=port)

workers = vine.Factory(manager_host_port="localhost:9123")
workers.max_workers = 1
workers.min_workers = 1
workers.cores = 1
workers.disk = 2000

with workers:
run = processor.Runner(
executor=executor,
skipbadfiles=True,
schema=processor.NanoAODSchema,
maxchunks=10000,
chunksize=1000,
)

hists = run(filelist, "Events", processor_instance=NanoEventsProcessor())
assert hists["cutflow"]["ZJets_pt"] == 18
assert hists["cutflow"]["ZJets_mass"] == 6
assert hists["cutflow"]["Data_pt"] == 84
assert hists["cutflow"]["Data_mass"] == 66

0 comments on commit 48e6bb9

Please sign in to comment.