dbader / dbader/schedule

How to create a counter within each run of my job

Open
#189 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
12.3k
Forks
999
PR merge metrics
No merged PRs in 30d

Description

Here is my code:

```
def job(count=0):
print("I'm working on:", str(count))

schedule.every(10).seconds.do(job)

count = 0
while True:

schedule.run_pending()
time.sleep(1)
count += 1

```

So, I'm confused about how i'd pass that count within my function. In the future, I plan to create a running list of live values that are being appended along with a counter and i'm not sure how i'd go about doing that

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue provides a Python snippet using schedule.every(...).do(job) and schedule.run_pending(); start by reviewing the documented callback and argument-passing behavior for those entry points. Done means providing a clear, documented explanation or example showing how a job can receive or retain the counter state.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.