WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 300ee30

Browse files
committed
update readme
1 parent 9792d57 commit 300ee30

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ PEASY_SHUTDOWN_TIMEOUT = 30 # grace seconds to wait for jobs to complete after r
7171

7272
When a job is called by the main Django application, a `PeasyJobQueue` object is created and added to the database. You can query this object both to track whether a background job was successful _and_ to manually add status updates to it (progress percentage, for example).
7373

74-
Peasy will update the status of the job on the edges of its work, i.e., the beginning and ending of the job. This includes whether the job succeeded, failed, or was cancelled. However, you can use `PeasyJobQueue.extra` to store an arbitrary dictionary for updating the job status throughout a background task.
74+
Peasy will update the status of the job on the edges of its work, i.e., the beginning and ending of the job. This includes whether the job succeeded, failed, or was cancelled. However, you can use `PeasyJobQueue.status_msg` and `PeasyJobQueue.extra` to store a string and arbitrary dictionary (respectively) for updating the job status throughout a background task.
7575

7676
Peasy will conveniently inject the `PeasyJobQueue` `pk` as an argument to your job function _if_ you add `job_pk` as an argument (and obviously, don't supply a value for it yourself from the calling code).
7777

@@ -83,10 +83,10 @@ from peasy_jobs.peasy_jobs import peasy
8383
@peasy.job("export data to s3")
8484
def generate_large_data_export(job_pk: int): # add job_pk here and it will automatically be injected.
8585
data = gather_data()
86-
PeasyJobQueue.objects.filter(pk=job_pk).update(extra={ # use the `extra` field for an arbitrary dictionary
87-
"progress": 50,
88-
"doing_now": "Succesfully gathered data. Now uploading data to s3."
89-
})
86+
peasy.update_status( # a convenience method for updating a peasy job status
87+
job_pk,
88+
status_msg="Succesfully gathered data. Now uploading data to s3.",
89+
extra={"progress": 50}) # use the `extra` field to optionally store an arbitrary dictionary.
9090
upload_data_to_s3(data)
9191
```
9292

src/peasy_jobs/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.0"
1+
__version__ = "0.3.1"

0 commit comments

Comments
 (0)