8000 Added user's guide section for export/import · agronholm/apscheduler@fcec69c · GitHub
[go: up one dir, main page]

Skip to content

Commit fcec69c

Browse files
committed
Added user's guide section for export/import
1 parent 50f67c8 commit fcec69c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/userguide.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,28 @@ Example::
458458
scheduler.add_listener(my_listener, EVENT_JOB_EXECUTED | EVENT_JOB_ERROR)
459459

460460

461+
Exporting and importing jobs
462+
----------------------------
463+
464+
If you need to migrate your jobs to a different job store, you need to first export the
465+
jobs to a JSON document and then import them back again.
466+
467+
Here's an example for exporting the jobs from all the scheduler's job stores::
468+
469+
# The scheduler has to be initialized, but can be paused
470+
scheduler.export_jobs("/tmp/jobs.json")
471+
472+
Then you will import the jobs in the destination scheduler::
473+
474+
# Again, the scheduler needs to be either running or paused
475+
scheduler.import_jobs("/tmp/jobs.json")
476+
477+
Both methods take a ``jobstore`` argument which can limit the source job store (on
478+
export), or specify a non-default target job store (on import). The first argument for
479+
both methods can either be an open file, a :class:`~pathlib.Path` or a file system path
480+
as a string.
481+
482+
461483
.. _troubleshooting:
462484

463485
Troubleshooting

0 commit comments

Comments
 (0)
0