From f5034327761eddf286316e814ca55a4f03ed35fc Mon Sep 17 00:00:00 2001 From: Kuba Mazurek Date: Thu, 2 Sep 2021 12:23:40 +0200 Subject: [PATCH] Add Script docstring --- yapapi/script/__init__.py | 15 ++++++++++++--- yapapi/script/capture.py | 2 -- yapapi/script/command.py | 2 -- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/yapapi/script/__init__.py b/yapapi/script/__init__.py index 6f7c68335..332852e19 100644 --- a/yapapi/script/__init__.py +++ b/yapapi/script/__init__.py @@ -1,5 +1,3 @@ -"""Stuff.""" - import asyncio from datetime import timedelta from typing import Any, Awaitable, Callable, Dict, Optional, List, Tuple, TYPE_CHECKING @@ -27,7 +25,18 @@ class Script: - """Stuff.""" + """Represents a series of commands to be executed on a provider node. + + New commands are added to the script either through its `add` method or by calling one of the + convenience methods provided (for example: `run` or `send_json`). + Adding a new command *does not* result in it being immediately executed. Once ready, a `Script` + instance is meant to be yielded from a worker function (work generator pattern). + Commands will be run in the order in which they were added to the script. + + If the `WorkContext` instance this `Script` uses has the field `_implicit_init` set to `True`, + the first script to be yielded is going to prepend the user's commands with `Deploy` and + `Start` commands. + """ timeout: Optional[timedelta] = None """Time after which this script's execution should be forcefully interrupted.""" diff --git a/yapapi/script/capture.py b/yapapi/script/capture.py index 967953484..a3e44a0ee 100644 --- a/yapapi/script/capture.py +++ b/yapapi/script/capture.py @@ -1,5 +1,3 @@ -"""Stuff.""" - from dataclasses import dataclass import enum from typing import Dict, Optional diff --git a/yapapi/script/command.py b/yapapi/script/command.py index 4f9bffa4d..cf2872bab 100644 --- a/yapapi/script/command.py +++ b/yapapi/script/command.py @@ -1,5 +1,3 @@ -"""Stuff.""" - import abc from functools import partial import json