File: client.py

package info (click to toggle)
apscheduler 3.11.2-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 872 kB
  • sloc: python: 7,326; makefile: 6
file content (18 lines) | stat: -rw-r--r-- 487 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""
This is an example RPC client that connects to the RPyC based scheduler service.

It first connects to the RPyC server on localhost:12345.
Then it schedules a job to run on 2 second intervals and sleeps for 10 seconds.
After that, it unschedules the job and exits.
"""

from time import sleep

import rpyc

conn = rpyc.connect("localhost", 12345)
job = conn.root.add_job(
    "server:print_text", "interval", args=["Hello, World"], seconds=2
)
sleep(10)
conn.root.remove_job(job.id)