Skip to content

Commit

Permalink
Merge pull request #453 from dthain/wq-awkward-update
Browse files Browse the repository at this point in the history
WQEX: Update example for current libraries:
  • Loading branch information
lgray authored Feb 18, 2021
2 parents aa0b2fb + 7fd7afe commit b7fe7ea
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions docs/source/wq-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
# Sample processor class given in the Coffea manual.
###############################################################

import uproot4
import uproot
from coffea.nanoevents import NanoEventsFactory, BaseSchema

# https://github.com/scikit-hep/uproot4/issues/122
uproot4.open.defaults["xrootd_handler"] = uproot4.source.xrootd.MultithreadedXRootDSource
uproot.open.defaults["xrootd_handler"] = uproot.source.xrootd.MultithreadedXRootDSource

import awkward1 as ak
import awkward as ak
from coffea import hist, processor

# register our candidate behaviors
Expand All @@ -49,6 +49,11 @@ def accumulator(self):
return self._accumulator

def process(self, events):

# Note: This is required to ensure that behaviors are registered
# when running this code in a remote task.
ak.behavior.update(candidate.behavior)

output = self.accumulator.identity()

dataset = events.metadata['dataset']
Expand Down Expand Up @@ -117,9 +122,7 @@ def postprocess(self, accumulator):
work_queue_executor_args = {

# Options are common to all executors:
'flatten': True,
'compression': 1,
'nano' : False,
'schema' : BaseSchema,
'skipbadfiles': False, # Note that maxchunks only works if this is false.

Expand Down

0 comments on commit b7fe7ea

Please sign in to comment.