Skip to content

Commit

Permalink
add option to shutdown worker when queue is empty (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmacata authored Jul 20, 2022
1 parent d1c52b4 commit 66cf9f7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/rq_custom_worker
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def main():
type=str,
required=False,
help="The path to the Actinia Core configuration file")
parser.add_argument('-q', "--quit",
action='store_true',
required=False,
help="Wether or not the worker should exit when the queue is emptied.")

args = parser.parse_args()

Expand Down Expand Up @@ -126,8 +130,10 @@ def main():
log_file_name))

actinia_worker = Worker([args.queue, ])
actinia_worker.work()

if bool(args.quit) is True:
actinia_worker.work(burst=True)
else:
actinia_worker.work()

if __name__ == '__main__':
main()

0 comments on commit 66cf9f7

Please sign in to comment.