Comments (3)
Thanks for explaining your use case. I've thought about this a bit, and I'm not convinced it's valuable to break 7 states into 4 groups with fuzzy names and ambiguous definitions. For example, retryable
is a "failure" state, and cancelled
doesn't necessarily mean there was a failure.
I'm in favor of enhancing state definitions, but these helpers are something you'll have to add to your application.
from oban.
Thanks for the suggestion (and the PR). Can you provide a concrete use case for categories of job states?
from oban.
Sure, I can, the following example is a piece of code that I'm using to list the reports requests that can fail for a bunch of reasons and I need show if the report(represented by a Oban.Job) is running, crashes or if it running/waiting, so I query the jobs and show then in a phoenix template that has this function:
def status(status) do
cond do
status in ~w(available retryable scheduled) -> "Waiting"
status == "completed" -> "Finished"
status == "executing" -> "Running"
true -> "Failed"
end
end
But is weird my interface layer knows by hard code the states of Oban, so this can turn into:
def status(status) do
case status do
status when status in Oban.Job.states(:waiting) -> "Waiting"
status when status in Oban.Job.states(:up) -> "Running"
:completed -> "Finished"
_ -> "Failed"
end
end
from oban.
Related Issues (20)
- timestamp fields in oban_jobs table doesn't have time zone causing AT TIME ZONE shift incorrect time HOT 2
- Oban crashing with RDS Proxy HOT 5
- assert_enqueued/2 fails to match a job by state=available and scheduled_at HOT 2
- Shared hook compilation failure HOT 5
- Oban Web fails when router helpers are disabled HOT 1
- `Oban.insert_all` spec is ambiguous HOT 5
- Smart Engine always wraps job insert statements in transaction HOT 2
- Is there way to check when the particular cron was executed last? HOT 1
- Structured jobs fail when using {:array, :uuid} HOT 1
- Incompatibility with Ecto 3.10.1 HOT 5
- Add first-class support for reliable execution guarantees to DynamicCron HOT 5
- Allow configuration for default priority HOT 4
- Oban.Migration queries do not emit `schema_migration: true` in telemetry metadata HOT 6
- SmartEngine: Don't fetch jobs that have reached max attempts HOT 1
- Oban.Pro.Queue.SmartEngine doesn't put oban telemetry metadata HOT 1
- Minor documentation clarification for Oban.Worker and Oban.Pro.Worker HOT 1
- KeyError key :limit not found HOT 2
- Support LiveView v0.19.x HOT 2
- Invalid jobs are gracefully inserted but corrupted upon Oban.insert_all of a workflow HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oban.