Skip to content

Commit 76d3561

Browse files
authored
Merge pull request #130 from Integration-Automation/dev
Update Doc
2 parents a052603 + bd848e3 commit 76d3561

File tree

7 files changed

+281
-44
lines changed

7 files changed

+281
-44
lines changed

.idea/workspace.xml

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/source/API/api_index.rst

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@ AutoControl API Documentation
22
----
33

44
.. toctree::
5-
:maxdepth: 4
5+
:maxdepth: 4
66

7-
wrapper/image.rst
8-
wrapper/keyboard.rst
9-
wrapper/mouse.rst
10-
wrapper/record.rst
11-
wrapper/screen.rst
12-
utils/callback.rst
13-
utils/critical_exit.rst
14-
utils/executor.rst
15-
utils/file.rst
16-
utils/generate_report.rst
17-
utils/package_manager.rst
18-
utils/socket_server.rst
19-
special/keyboard_keys.rst
20-
special/mouse_keys.rst
7+
wrapper/image.rst
8+
wrapper/keyboard.rst
9+
wrapper/mouse.rst
10+
wrapper/record.rst
11+
wrapper/screen.rst
12+
utils/callback.rst
13+
utils/critical_exit.rst
14+
utils/executor.rst
15+
utils/scheduler.rst
16+
utils/file.rst
17+
utils/generate_report.rst
18+
utils/package_manager.rst
19+
utils/socket_server.rst
20+
special/keyboard_keys.rst
21+
special/mouse_keys.rst

docs/source/API/utils/scheduler.rst

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
Scheduler API
2+
----
3+
4+
.. code-block:: python
5+
6+
def add_blocking_job(
7+
self, func: Callable, trigger: str = None, args: Union[list, tuple] = None,
8+
kwargs: dict = None, id: str = None, name: str = None,
9+
misfire_grace_time: int = undefined, coalesce: bool = undefined, max_instances: int = undefined,
10+
next_run_time: datetime = undefined, jobstore: str = 'default', executor: str = 'default',
11+
replace_existing: bool = False, **trigger_args: Any) -> Job:
12+
"""
13+
Just an apscheduler add job wrapper.
14+
:param func: callable (or a textual reference to one) to run at the given time
15+
:param str|apscheduler.triggers.base.BaseTrigger trigger: trigger that determines when
16+
``func`` is called
17+
:param list|tuple args: list of positional arguments to call func with
18+
:param dict kwargs: dict of keyword arguments to call func with
19+
:param str|unicode id: explicit identifier for the job (for modifying it later)
20+
:param str|unicode name: textual description of the job
21+
:param int misfire_grace_time: seconds after the designated runtime that the job is still
22+
allowed to be run (or ``None`` to allow the job to run no matter how late it is)
23+
:param bool coalesce: run once instead of many times if the scheduler determines that the
24+
job should be run more than once in succession
25+
:param int max_instances: maximum number of concurrently running instances allowed for this
26+
job
27+
:param datetime next_run_time: when to first run the job, regardless of the trigger (pass
28+
``None`` to add the job as paused)
29+
:param str|unicode jobstore: alias of the job store to store the job in
30+
:param str|unicode executor: alias of the executor to run the job with
31+
:param bool replace_existing: ``True`` to replace an existing job with the same ``id``
32+
(but retain the number of runs from the existing one)
33+
:return: Job
34+
"""
35+
36+
.. code-block:: python
37+
38+
def add_nonblocking_job(
39+
self, func: Callable, trigger: str = None, args: Union[list, tuple] = None,
40+
kwargs: dict = None, id: str = None, name: str = None,
41+
misfire_grace_time: int = undefined, coalesce: bool = undefined, max_instances: int = undefined,
42+
next_run_time: datetime = undefined, jobstore: str = 'default', executor: str = 'default',
43+
replace_existing: bool = False, **trigger_args: Any) -> Job:
44+
"""
45+
Just an apscheduler add job wrapper.
46+
:param func: callable (or a textual reference to one) to run at the given time
47+
:param str|apscheduler.triggers.base.BaseTrigger trigger: trigger that determines when
48+
``func`` is called
49+
:param list|tuple args: list of positional arguments to call func with
50+
:param dict kwargs: dict of keyword arguments to call func with
51+
:param str|unicode id: explicit identifier for the job (for modifying it later)
52+
:param str|unicode name: textual description of the job
53+
:param int misfire_grace_time: seconds after the designated runtime that the job is still
54+
allowed to be run (or ``None`` to allow the job to run no matter how late it is)
55+
:param bool coalesce: run once instead of many times if the scheduler determines that the
56+
job should be run more than once in succession
57+
:param int max_instances: maximum number of concurrently running instances allowed for this
58+
job
59+
:param datetime next_run_time: when to first run the job, regardless of the trigger (pass
60+
``None`` to add the job as paused)
61+
:param str|unicode jobstore: alias of the job store to store the job in
62+
:param str|unicode executor: alias of the executor to run the job with
63+
:param bool replace_existing: ``True`` to replace an existing job with the same ``id``
64+
(but retain the number of runs from the existing one)
65+
:return: Job
66+
"""
67+
68+
.. code-block:: python
69+
70+
def get_blocking_scheduler(self) -> BlockingScheduler:
71+
"""
72+
Return self blocking scheduler
73+
:return: BlockingScheduler
74+
"""
75+
76+
.. code-block:: python
77+
78+
def get_nonblocking_scheduler(self) -> BackgroundScheduler:
79+
"""
80+
Return self background scheduler
81+
:return: BackgroundScheduler
82+
"""
83+
84+
.. code-block:: python
85+
86+
def start_block_scheduler(self, *args: Any, **kwargs: Any) -> None:
87+
"""
88+
Start blocking scheduler
89+
:return: None
90+
"""
91+
92+
.. code-block:: python
93+
94+
def start_nonblocking_scheduler(self, *args: Any, **kwargs: Any) -> None:
95+
"""
96+
Start background scheduler
97+
:return: None
98+
"""
99+
100+
.. code-block:: python
101+
102+
def start_all_scheduler(self, *args: Any, **kwargs: Any) -> None:
103+
"""
104+
Start background and blocking scheduler
105+
:return: None
106+
"""
107+
108+
.. code-block:: python
109+
110+
def add_interval_blocking_secondly(
111+
self, function: Callable, id: str = None, args: Union[list, tuple] = None,
112+
kwargs: dict = None, seconds: int = 1, **trigger_args: Any) -> Job:
113+
114+
.. code-block:: python
115+
116+
def add_interval_blocking_minutely(
117+
self, function: Callable, id: str = None, args: Union[list, tuple] = None,
118+
kwargs: dict = None, minutes: int = 1, **trigger_args: Any) -> Job:
119+
120+
.. code-block:: python
121+
122+
def add_interval_blocking_hourly(
123+
self, function: Callable, id: str = None, args: Union[list, tuple] = None,
124+
kwargs: dict = None, hours: int = 1, **trigger_args: Any) -> Job:
125+
126+
.. code-block:: python
127+
128+
def add_interval_blocking_daily(
129+
self, function: Callable, id: str = None, args: Union[list, tuple] = None,
130+
kwargs: dict = None, days: int = 1, **trigger_args: Any) -> Job:
131+
132+
.. code-block:: python
133+
134+
def add_interval_blocking_weekly(
135+
self, function: Callable, id: str = None, args: Union[list, tuple] = None,
136+
kwargs: dict = None, weeks: int = 1, **trigger_args: Any) -> Job:
137+
138+
.. code-block:: python
139+
140+
def add_interval_nonblocking_secondly(
141+
self, function: Callable, id: str = None, args: list = None,
142+
kwargs: dict = None, seconds: int = 1, **trigger_args: Any) -> Job:
143+
144+
.. code-block:: python
145+
146+
def add_interval_nonblocking_minutely(
147+
self, function: Callable, id: str = None, args: list = None,
148+
kwargs: dict = None, minutes: int = 1, **trigger_args: Any) -> Job:
149+
150+
.. code-block:: python
151+
152+
def add_interval_nonblocking_hourly(
153+
self, function: Callable, id: str = None, args: Union[list, tuple] = None,
154+
kwargs: dict = None, hours: int = 1, **trigger_args: Any) -> Job:
155+
156+
.. code-block:: python
157+
158+
def add_interval_nonblocking_daily(
159+
self, function: Callable, id: str = None, args: Union[list, tuple] = None,
160+
kwargs: dict = None, days: int = 1, **trigger_args: Any) -> Job:
161+
162+
.. code-block:: python
163+
164+
def add_interval_nonblocking_weekly(
165+
self, function: Callable, id: str = None, args: Union[list, tuple] = None,
166+
kwargs: dict = None, weeks: int = 1, **trigger_args: Any) -> Job:
167+
168+
.. code-block:: python
169+
170+
def add_cron_blocking(
171+
self, function: Callable, id: str = None, **trigger_args: Any) -> Job:
172+
173+
.. code-block:: python
174+
175+
def add_cron_nonblocking(
176+
self, function: Callable, id: str = None, **trigger_args: Any) -> Job:
177+
178+
.. code-block:: python
179+
180+
def remove_blocking_job(self, id: str, jobstore: str = 'default') -> Any:
181+
182+
.. code-block:: python
183+
184+
def remove_nonblocking_job(self, id: str, jobstore: str = 'default') -> Any:
185+
186+
.. code-block:: python
187+
188+
def shutdown_blocking_scheduler(self, wait: bool = False) -> None:
189+
190+
.. code-block:: python
191+
192+
def shutdown_nonblocking_scheduler(self, wait: bool = False) -> None:
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Scheduler
2+
----
3+
4+
You can use scheduling to perform repetitive tasks, either by using a simple wrapper for APScheduler or by consulting the API documentation to use it yourself.
5+
6+
.. code-block:: python
7+
8+
from je_auto_control import SchedulerManager
9+
10+
11+
def test_scheduler():
12+
print("Test Scheduler")
13+
scheduler.remove_blocking_job(id="test")
14+
scheduler.shutdown_blocking_scheduler()
15+
16+
17+
scheduler = SchedulerManager()
18+
scheduler.add_interval_blocking_secondly(function=test_scheduler, id="test")
19+
scheduler.start_block_scheduler()

docs/source/Eng/eng_index.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ AutoControl English Documentation
33
====================================
44

55
.. toctree::
6-
:maxdepth: 4
6+
:maxdepth: 4
77

8-
doc/installation/installation_doc.rst
9-
doc/create_project/create_project_doc.rst
10-
doc/keyboard/keyboard_doc.rst
11-
doc/mouse/mouse_doc.rst
12-
doc/screen/screen_doc.rst
13-
doc/image/image_doc.rst
14-
doc/record/record_doc.rst
15-
doc/generate_report/generate_report_doc.rst
16-
doc/callback_function/callback_function_doc.rst
17-
doc/keyword_and_executor/keyword_and_executor_doc.rst
18-
doc/critical_exit/critical_exit_doc.rst
19-
doc/cli/cli_doc.rst
20-
doc/socket_driver/socket_driver_doc.rst
8+
doc/installation/installation_doc.rst
9+
doc/create_project/create_project_doc.rst
10+
doc/keyboard/keyboard_doc.rst
11+
doc/mouse/mouse_doc.rst
12+
doc/screen/screen_doc.rst
13+
doc/image/image_doc.rst
14+
doc/record/record_doc.rst
15+
doc/generate_report/generate_report_doc.rst
16+
doc/callback_function/callback_function_doc.rst
17+
doc/keyword_and_executor/keyword_and_executor_doc.rst
18+
doc/critical_exit/critical_exit_doc.rst
19+
doc/cli/cli_doc.rst
20+
doc/scheduler/scheduler_doc.rst
21+
doc/socket_driver/socket_driver_doc.rst
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Scheduler
2+
----
3+
4+
可以使用排程來執行重複的任務,可以使用對 APScheduler 的簡易包裝或是觀看 API 文件自行使用
5+
6+
.. code-block:: python
7+
8+
from je_auto_control import SchedulerManager
9+
10+
11+
def test_scheduler():
12+
print("Test Scheduler")
13+
scheduler.remove_blocking_job(id="test")
14+
scheduler.shutdown_blocking_scheduler()
15+
16+
17+
scheduler = SchedulerManager()
18+
scheduler.add_interval_blocking_secondly(function=test_scheduler, id="test")
19+
scheduler.start_block_scheduler()

docs/source/Zh/zh_index.rst

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ AutoControl 繁體中文 文件
44
.. toctree::
55
:maxdepth: 4
66

7-
doc/installation/installation_doc.rst
8-
doc/create_project/create_project_doc.rst
9-
doc/keyboard/keyboard_doc.rst
10-
doc/mouse/mouse_doc.rst
11-
doc/screen/screen_doc.rst
12-
doc/image/image_doc.rst
13-
doc/record/record_doc.rst
14-
doc/generate_report/generate_report_doc.rst
15-
doc/callback_function/callback_function_doc.rst
16-
doc/keyword_and_executor/keyword_and_executor_doc.rst
17-
doc/critical_exit/critical_exit_doc.rst
18-
doc/cli/cli_doc.rst
19-
doc/socket_driver/socket_driver_doc.rst
7+
doc/installation/installation_doc.rst
8+
doc/create_project/create_project_doc.rst
9+
doc/keyboard/keyboard_doc.rst
10+
doc/mouse/mouse_doc.rst
11+
doc/screen/screen_doc.rst
12+
doc/image/image_doc.rst
13+
doc/record/record_doc.rst
14+
doc/generate_report/generate_report_doc.rst
15+
doc/callback_function/callback_function_doc.rst
16+
doc/keyword_and_executor/keyword_and_executor_doc.rst
17+
doc/critical_exit/critical_exit_doc.rst
18+
doc/cli/cli_doc.rst
19+
doc/scheduler/scheduler_doc.rst
20+
doc/socket_driver/socket_driver_doc.rst

0 commit comments

Comments
 (0)