From 1cc7ff8e04f8b04f41b0fb8b155cc19bfa43f808 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 21 Jan 2019 12:20:33 +0800 Subject: [PATCH] task: reformat the docstring for sphinx the code block should start with `::`, and should be indented. Signed-off-by: Kefu Chai --- teuthology/provision/cloud/util.py | 2 +- teuthology/task/background_exec.py | 2 +- teuthology/task/clock.py | 10 +++++----- teuthology/task/full_sequential.py | 8 ++++---- teuthology/task/lockfile.py | 24 ++++++++++++----------- teuthology/task/loop.py | 13 +++++++------ teuthology/task/parallel.py | 31 +++++++++++++++--------------- teuthology/task/sequential.py | 29 ++++++++++++++-------------- teuthology/task/tasktest.py | 16 +++++++-------- teuthology/task/tests/__init__.py | 6 +++--- teuthology/task/timer.py | 12 ++++++------ 11 files changed, 79 insertions(+), 74 deletions(-) diff --git a/teuthology/provision/cloud/util.py b/teuthology/provision/cloud/util.py index e9afa22b4a..aaf255a0ff 100644 --- a/teuthology/provision/cloud/util.py +++ b/teuthology/provision/cloud/util.py @@ -38,7 +38,7 @@ def selective_update(a, b, func): pairs in the second dict and merges them into the first dict if func() returns a "Truthy" value. - Example: + Example:: >>> a = dict(x=0, y=1, z=3) >>> b = dict(x=1, y=2, z=0) diff --git a/teuthology/task/background_exec.py b/teuthology/task/background_exec.py index ffe36efa93..76d58bd40d 100644 --- a/teuthology/task/background_exec.py +++ b/teuthology/task/background_exec.py @@ -25,7 +25,7 @@ def task(ctx, config): If the command a list, we simply join it with ;'s. - Example: + Example:: tasks: - install: diff --git a/teuthology/task/clock.py b/teuthology/task/clock.py index cf3fe1784d..53a349c866 100644 --- a/teuthology/task/clock.py +++ b/teuthology/task/clock.py @@ -17,12 +17,12 @@ def task(ctx, config): This will initially sync the clocks. Eventually it should let us also skew by some number of seconds. - example: + example:: - tasks: - - clock: - - ceph: - - interactive: + tasks: + - clock: + - ceph: + - interactive: to sync. diff --git a/teuthology/task/full_sequential.py b/teuthology/task/full_sequential.py index 197a554968..4114d92da2 100644 --- a/teuthology/task/full_sequential.py +++ b/teuthology/task/full_sequential.py @@ -14,10 +14,10 @@ def task(ctx, config): Run a set of tasks to completion in order. __exit__ is called on a task before __enter__ on the next - example: - - full_sequential: - - tasktest: - - tasktest: + example:: + - full_sequential: + - tasktest: + - tasktest: :param ctx: Context :param config: Configuration diff --git a/teuthology/task/lockfile.py b/teuthology/task/lockfile.py index 8c18d46164..a1980c2103 100644 --- a/teuthology/task/lockfile.py +++ b/teuthology/task/lockfile.py @@ -25,17 +25,19 @@ def task(ctx, config): Optional entries are the "offset" and "length" of the lock. You can also specify a "maxwait" timeout period which fails if the executable takes longer to complete, and an "expectfail". - An example: - tasks: - - ceph: - - ceph-fuse: [client.0, client.1] - - lockfile: - [{client:client.0, file:testfile, holdtime:10}, - {client:client.1, file:testfile, holdtime:0, maxwait:0, expectfail:true}, - {client:client.1, file:testfile, holdtime:0, maxwait:15, expectfail:false}, - 10, - {client: client.1, lockfile: testfile, holdtime: 5}, - {client: client.2, lockfile: testfile, holdtime: 5, maxwait: 1, expectfail: True}] + + An example:: + + tasks: + - ceph: + - ceph-fuse: [client.0, client.1] + - lockfile: + [{client:client.0, file:testfile, holdtime:10}, + {client:client.1, file:testfile, holdtime:0, maxwait:0, expectfail:true}, + {client:client.1, file:testfile, holdtime:0, maxwait:15, expectfail:false}, + 10, + {client: client.1, lockfile: testfile, holdtime: 5}, + {client: client.2, lockfile: testfile, holdtime: 5, maxwait: 1, expectfail: True}] In the past this test would have failed; there was a bug where waitlocks weren't diff --git a/teuthology/task/loop.py b/teuthology/task/loop.py index 598f561a54..1fa0152a0e 100644 --- a/teuthology/task/loop.py +++ b/teuthology/task/loop.py @@ -12,12 +12,13 @@ def task(ctx, config): """ Loop a sequential group of tasks - example: - - loop: - count: 10 - body: - - tasktest: - - tasktest: + example:: + + - loop: + count: 10 + body: + - tasktest: + - tasktest: :param ctx: Context :param config: Configuration diff --git a/teuthology/task/parallel.py b/teuthology/task/parallel.py index c5ea85a55a..d96391a5e0 100644 --- a/teuthology/task/parallel.py +++ b/teuthology/task/parallel.py @@ -14,28 +14,29 @@ def task(ctx, config): """ Run a group of tasks in parallel. - example: - - parallel: - - tasktest: - - tasktest: + example:: + + - parallel: + - tasktest: + - tasktest: You can also define tasks in a top-level section outside of 'tasks:', and reference them here. The referenced section must contain a list of tasks to run sequentially, or a single task as a dict. The latter is only - available for backwards compatibility with existing suites: + available for backwards compatibility with existing suites:: - tasks: - - parallel: - - tasktest: # task inline - - foo # reference to top-level 'foo' section - - bar # reference to top-level 'bar' section - foo: - - tasktest1: - - tasktest2: - bar: - tasktest: # note the list syntax from 'foo' is preferred + tasks: + - parallel: + - tasktest: # task inline + - foo # reference to top-level 'foo' section + - bar # reference to top-level 'bar' section + foo: + - tasktest1: + - tasktest2: + bar: + tasktest: # note the list syntax from 'foo' is preferred That is, if the entry is not a dict, we will look it up in the top-level config. diff --git a/teuthology/task/sequential.py b/teuthology/task/sequential.py index 690d60f118..ad37108d01 100644 --- a/teuthology/task/sequential.py +++ b/teuthology/task/sequential.py @@ -13,20 +13,21 @@ def task(ctx, config): """ Sequentialize a group of tasks into one executable block - example: - - sequential: - - tasktest: - - tasktest: - - You can also reference the job from elsewhere: - - foo: - tasktest: - tasks: - - sequential: - - tasktest: - - foo - - tasktest: + example:: + + - sequential: + - tasktest: + - tasktest: + + You can also reference the job from elsewhere:: + + foo: + tasktest: + tasks: + - sequential: + - tasktest: + - foo + - tasktest: That is, if the entry is not a dict, we will look it up in the top-level config. diff --git a/teuthology/task/tasktest.py b/teuthology/task/tasktest.py index 74a12c2f8f..40926c569c 100644 --- a/teuthology/task/tasktest.py +++ b/teuthology/task/tasktest.py @@ -15,16 +15,16 @@ def task(ctx, config): destroyed/cleaned up. This task was used to test parallel and sequential task options. - example: + example:: - tasks: - - sequential: + tasks: + - sequential: + - tasktest: + - id: 'foo' + - tasktest: + - id: 'bar' + - delay:5 - tasktest: - - id: 'foo' - - tasktest: - - id: 'bar' - - delay:5 - - tasktest: The above yaml will sequentially start a test task named foo and a test task named bar. Bar will take 5 seconds to complete. After foo and bar diff --git a/teuthology/task/tests/__init__.py b/teuthology/task/tests/__init__.py index 8769710b10..136ae049bc 100644 --- a/teuthology/task/tests/__init__.py +++ b/teuthology/task/tests/__init__.py @@ -5,10 +5,10 @@ the current directory. Each test that is discovered will be passed the teuthology ctx and config args that each teuthology task usually gets. This allows the tests to operate against the cluster. -An example: +An example:: -tasks - - tests: + tasks + - tests: """ import logging diff --git a/teuthology/task/timer.py b/teuthology/task/timer.py index d47830f44e..2abf188275 100644 --- a/teuthology/task/timer.py +++ b/teuthology/task/timer.py @@ -15,13 +15,13 @@ def task(ctx, config): Measure the time that this set of tasks takes and save that value in the summary file. Config is a description of what we are timing. - example: + example:: - tasks: - - ceph: - - foo: - - timer: "fsx run" - - fsx: + tasks: + - ceph: + - foo: + - timer: "fsx run" + - fsx: """ start = datetime.datetime.now() -- 2.39.5