Skip to content

coffea.compute backend interface design #1486

@nsmith-

Description

@nsmith-

When I originally heard the term coffea.compute, I thought it's going to be a function (and the namespace would have a different name).
I was imagining something like coffea.compute(some computable, executor=something) sort of like what dask.compute does where you tell it what to compute and some executor/scheduler.
Is this out of the question? Is there a strong reason why you preferred coffea.compute be a namespace and have backend.compute do the execution?

I thought about that originally, but context managers are very nice things to have. I see bugs in clearing the progress bar, for example, that are probably as a result of the lack of these currently that would be nice to get past once and for all.

Originally posted by @nsmith- in #1470 (comment)

A possible compromise to have both is as follows:

No context manager approach:

backend = Backend()
result = backend.compute(blah)  # blocking

Context manager approach:

with Backend() as backend:
    task = backend.compute(blah)  # non-blocking
    out = task.result() # blocking

Internally, the context manager just does with self: to implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions