Skip to content

Commit

Permalink
simplify examples
Browse files Browse the repository at this point in the history
  • Loading branch information
crispyDyne committed Jul 29, 2020
1 parent d039637 commit 5a43df5
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions examples/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
from redis import Redis

from rq_manager import manager, getProjectResults
from exampleTasks import addSubJob, simpleTask, addJobs, addSubJob
from pprint import pprint

from exampleTasks import addSubJob, simpleTask, addJobs, addSubJob

#### Examples are slow because "sleepTime" default is 1 second ####

# Tell RQ what Redis connection to use
redis_conn = Redis()
q = Queue(connection=redis_conn,is_async=True) # no args implies the default queue
q = Queue(connection=Redis())

### Run jobs in parallel:
project = {'jobs':[
Expand All @@ -20,7 +18,7 @@

managerJob = q.enqueue(manager,project)
projectResults = getProjectResults(managerJob)
pprint(projectResults)
print(projectResults)

### Run jobs in series:
project = {'jobs':[
Expand All @@ -30,7 +28,7 @@

managerJob = q.enqueue(manager,project)
projectResults = getProjectResults(managerJob)
pprint(projectResults)
print(projectResults)

### Run with dependent arguments:
project = {'jobs':[
Expand All @@ -41,7 +39,7 @@

managerJob = q.enqueue(manager,project)
projectResults = getProjectResults(managerJob)
pprint(projectResults)
print(projectResults)

### Run jobs with multiple dependancy:
project = {'jobs':[
Expand All @@ -58,7 +56,7 @@

managerJob = q.enqueue(manager,project)
projectResults = getProjectResults(managerJob)
pprint(projectResults)
print(projectResults)

### Add jobs as you go
project = {'jobs':[
Expand All @@ -75,7 +73,7 @@

managerJob = q.enqueue(manager,project)
projectResults = getProjectResults(managerJob)
pprint(projectResults)
print(projectResults)

### Add a job with child jobs as you go
project = {'jobs':[
Expand All @@ -92,4 +90,4 @@

managerJob = q.enqueue(manager,project)
projectResults = getProjectResults(managerJob)
pprint(projectResults)
print(projectResults)

0 comments on commit 5a43df5

Please sign in to comment.