Scheduler¶
Workflow-based job pipeline. Narrative guide: Scheduler.
Task¶
pypepper.scheduler.task
¶
Scheduler task data structures.
ITask
¶
Bases: IBase
Source code in pypepper/scheduler/task.py
Task
¶
Bases: ITask
Source code in pypepper/scheduler/task.py
Workflow¶
pypepper.scheduler.workflow
¶
Sequential workflow runner over tasks.
IWorkflow
¶
Workflow
¶
Bases: IWorkflow
Source code in pypepper/scheduler/workflow.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
add_task
¶
add_tasks
¶
get_tasks
¶
run
¶
Sequentially execute tasks.
Per task:
- round_times outer rounds (default 1); each round has its own retry budget.
Success returns early; later rounds run only after a full failed inner budget.
- round_timeout seconds soft-timeout per execute attempt (0 = none). Timed-out
work that already started may keep running on the shared soft-timeout pool; the
next attempt can overlap. Concurrent soft-timeout executes are capped
(_SOFT_TIMEOUT_MAX_WORKERS, including orphans); further work queues and a
short timeout may fire before the task starts. Queued work that times out
before start is cancelled when possible so it does not run later.
- Retry modes: until false → retry_count + 1; until + count 0 → per-round
retry_until_max; until + count > 0 → retry_count + 1 (max ignored).
- optional: failed optional tasks continue the workflow.
Non-optional task failure after all rounds/attempts aborts the workflow.
Source code in pypepper/scheduler/workflow.py
Job¶
pypepper.scheduler.job
¶
Job model, processor, and dispatcher.
ChannelFullError
¶
Processor
¶
Source code in pypepper/scheduler/job.py
run
¶
Source code in pypepper/scheduler/job.py
async_run
async
staticmethod
¶
Source code in pypepper/scheduler/job.py
Dispatcher
¶
Source code in pypepper/scheduler/job.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
dispatch
¶
Source code in pypepper/scheduler/job.py
IJob
¶
Bases: IBase
Source code in pypepper/scheduler/job.py
Job
¶
Bases: IJob
Source code in pypepper/scheduler/job.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
is_cancelled
¶
restore_lifecycle
¶
Restore FSM/status after schedule/enqueue failure or RUN-start persist failure.
apply_event
¶
cancel
¶
Cancel a Scheduled or InProgress job and persist Cancelled.
On save() failure the FSM stays Cancelled; retry job.save() only.
to_record
¶
Authoritative lifecycle snapshot from the FSM (may lead durable status).
Source code in pypepper/scheduler/job.py
save
¶
Source code in pypepper/scheduler/job.py
get_saved
staticmethod
¶
Source code in pypepper/scheduler/job.py
log
¶
Channel¶
pypepper.scheduler.channel
¶
Async job channels and channel manager.
Channel
¶
Source code in pypepper/scheduler/channel.py
ChannelManager
¶
Source code in pypepper/scheduler/channel.py
put
¶
get
¶
remove
¶
new
¶
Return the channel for key, creating it on first use.
maxsize applies only when the channel is created (0 = unbounded).
If the key already exists, the existing channel is returned and maxsize
is ignored (create bounded channels before Worker/dispatch).
Source code in pypepper/scheduler/channel.py
available
¶
Worker¶
pypepper.scheduler.worker
¶
Channel consumer that runs job workflows.
Worker
¶
Consume jobs from a channel and run their workflows.
Source code in pypepper/scheduler/worker.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
run_once
async
¶
Executor¶
pypepper.scheduler.executor
¶
Task executor interfaces and callable adapter.
IExecutor
¶
Source code in pypepper/scheduler/executor.py
Executor
¶
Bases: IExecutor
No-op executor (placeholder for tasks without work).
Source code in pypepper/scheduler/executor.py
Events¶
pypepper.scheduler.events
¶
Scheduler FSM events and builder.
FSM
¶
Per-instance scheduler FSM wrapper (backward-compatible API).
Source code in pypepper/scheduler/events.py
Job store¶
pypepper.scheduler.store
¶
Pluggable job persistence (memory / postgres / mysql / mongodb).
IJobStore
¶
Pluggable persistence for JobRecord snapshots.
Source code in pypepper/scheduler/store/interfaces.py
JobRecord
dataclass
¶
Serializable job snapshot (metadata only; no executors).
Source code in pypepper/scheduler/store/interfaces.py
InMemoryJobStore
¶
Bases: IJobStore
Thread-safe dict-backed job store.
Source code in pypepper/scheduler/store/memory.py
get_job_store
¶
reset_job_store_mismatch_warning
¶
Reset the durable-vs-memory mismatch one-shot warn (tests).
set_job_store
¶
Replace the process-wide job store and clear any deferred durable YAML flag.
Source code in pypepper/scheduler/store/__init__.py
reset_job_store
¶
Reset to a fresh in-memory store (tests / process reset).
Does not acknowledge a deferred durable YAML backend: if the current
config still declares a non-memory jobStore, deferred fail-fast is
re-armed so Job.save cannot silently use memory.
Also clears the durable-vs-memory mismatch one-shot so a later explicit memory install can warn again for the new cycle.
Source code in pypepper/scheduler/store/__init__.py
configure_job_store
¶
Build and install a job store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backend
|
Backend
|
|
'memory'
|
**kwargs
|
Any
|
Connection options forwarded to the backend (e.g. |
{}
|
Source code in pypepper/scheduler/store/__init__.py
setup_from_config
¶
Configure job store from YAML scheduler.jobStore (optional).