Jobs
List of jobs Python functions in the FarmBot Python library
set_job(job_name, status=”Working”, percent=0)
Creates or updates a job in the jobs popup. This is useful for tracking long running tasks such as photo grids.
# Create a job:
local job_name = "Scan the garden"
fb.set_job(job_name)
fb.wait(2000)
# Update the job's status and percent:
fb.set_job(job_name, status="Still working...", percent=50)
fb.wait(2000)
# Update just the job's percent:
fb.set_job(job_name, percent=75)
fb.wait(2000)
# Complete the job:
fb.complete_job(job_name)
get_job(job_name=None)
Gets a job by name.
# Get a job:
job = fb.get_job("Job name")
job_name = "Scan the garden"
fb.set_job(job_name, percent=50)
job = fb.get_job(job_name)
fb.toast(f"Job progress: {job['percent']}%")
fb.complete_job(job_name)
# Get all jobs:
jobs = fb.get_job()
complete_job(name)
Completes a job by name, where complete means a percent
of 100
and a status
of Complete
.
# Complete a job:
fb.complete_job("Job name")