Edit docstring formatting and spacing (#1403)

This commit is contained in:
pollfly 2025-04-28 09:22:00 +03:00 committed by GitHub
parent 95baa6ba16
commit b6d358c1f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 81 additions and 41 deletions

View File

@ -580,23 +580,58 @@ class TaskScheduler(BaseScheduler):
Examples:
Launch every 15 minutes
Launch every 15 minutes:
.. code-block:: py
add_task(schedule_task_id='1235', queue='default', minute=15)
Launch every 1 hour
Launch every 1 hour:
.. code-block:: py
add_task(schedule_task_id='1235', queue='default', hour=1)
Launch every 1 hour at hour:30 minutes (i.e. 1:30, 2:30 etc.)
Launch every 1 hour at hour:30 minutes (i.e. 1:30, 2:30 etc.):
.. code-block:: py
add_task(schedule_task_id='1235', queue='default', hour=1, minute=30)
Launch every day at 22:30 (10:30 pm)
Launch every day at 22:30 (10:30 pm):
.. code-block:: py
add_task(schedule_task_id='1235', queue='default', minute=30, hour=22, day=1)
Launch every other day at 7:30 (7:30 am)
Launch every other day at 7:30 (7:30 am):
.. code-block:: py
add_task(schedule_task_id='1235', queue='default', minute=30, hour=7, day=2)
Launch every Saturday at 8:30am (notice `day=0`)
Launch every Saturday at 8:30am (notice `day=0`):
.. code-block:: py
add_task(schedule_task_id='1235', queue='default', minute=30, hour=8, day=0, weekdays=['saturday'])
Launch every 2 hours on the weekends Saturday/Sunday (notice `day` is not passed)
Launch every 2 hours on the weekends Saturday/Sunday (notice `day` is not passed):
.. code-block:: py
add_task(schedule_task_id='1235', queue='default', hour=2, weekdays=['saturday', 'sunday'])
Launch once a month at the 5th of each month
Launch once a month at the 5th of each month:
.. code-block:: py
add_task(schedule_task_id='1235', queue='default', month=1, day=5)
Launch once a year on March 4th
Launch once a year on March 4th:
.. code-block:: py
add_task(schedule_task_id='1235', queue='default', year=1, month=3, day=4)
:param schedule_task_id: ID of Task to be cloned and scheduled for execution

View File

@ -2467,12 +2467,18 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
"""
Force the adding of a package to the requirements list. If ``package_version`` is None, use the
installed package version, if found.
Example: Task.add_requirements('tensorflow', '2.4.0')
Example: Task.add_requirements('tensorflow', '>=2.4')
Example: Task.add_requirements('tensorflow') -> use the installed tensorflow version
Example: Task.add_requirements('tensorflow', '') -> no version limit
Alternatively, you can add all requirements from a file.
Example: Task.add_requirements('/path/to/your/project/requirements.txt')
Example: ``Task.add_requirements('tensorflow', '2.4.0')``
Example: ``Task.add_requirements('tensorflow', '>=2.4')``
Example: ``Task.add_requirements('tensorflow')`` -> use the installed tensorflow version
Example: ``Task.add_requirements('tensorflow', '')`` -> no version limit
Alternatively, you can add all requirements from a file:
Example: ``Task.add_requirements('/path/to/your/project/requirements.txt')``
.. note::
Task.add_requirements does not directly modify the task's requirements. Instead, it improves the accuracy

View File

@ -448,8 +448,7 @@ class Task(_Task):
- ``True`` - Automatically create resource monitoring plots. (default)
- ``False`` - Do not automatically create.
- Class Type - Create ResourceMonitor object of the specified class type.
- dict - Dictionary of kwargs to be passed to the ResourceMonitor instance.
The keys can be:
- dict - Dictionary of kwargs to be passed to the ResourceMonitor instance. The keys can be:
- `report_start_sec` OR `first_report_sec` OR `seconds_from_start` - Maximum number of seconds
to wait for scalar/plot reporting before defaulting
to machine statistics reporting based on seconds from experiment start time
@ -459,8 +458,8 @@ class Task(_Task):
- `max_wait_for_first_iteration_to_start_sec` - Set the maximum time (seconds) to allow the resource
monitoring to revert back to iteration reporting x-axis after starting to report `seconds_from_start`
- `report_mem_used_per_process` OR `report_global_mem_used` - Compatibility feature,
report memory usage for the entire machine
default (false), report only on the running process and its sub-processes
report memory usage for the entire machine.
Default (false), report only on the running process and its sub-processes
:param auto_connect_streams: Control the automatic logging of stdout and stderr.
The values are: