tasks Package

future Module

exception cbtestlib.tasks.future.CancelledError

Bases: cbtestlib.tasks.future.Error

The Future was cancelled.

exception cbtestlib.tasks.future.Error

Bases: exceptions.Exception

Base class for all future-related exceptions.

class cbtestlib.tasks.future.Future

Bases: object

Represents the result of an asynchronous computation.

add_done_callback(fn)

Attaches a callable that will be called when the future finishes.

Args:
fn: A callable that will be called with this future as its only
argument when the future completes or is cancelled. The callable will always be called by a thread in the same process in which it was added. If the future has already completed or been cancelled then the callable will be called immediately. These callables are called in the order that they were added.
cancel()

Cancel the future if possible.

Returns True if the future was cancelled, False otherwise. A future cannot be cancelled if it is running or has already completed.

cancelled()

Return True if the future has cancelled.

done()

Return True of the future was cancelled or finished executing.

exception(timeout=None)

Return the exception raised by the call that the future represents.

Args:
timeout: The number of seconds to wait for the exception if the
future isn’t done. If None, then there is no limit on the wait time.
Returns:
The exception raised by the call that the future represents or None if the call completed without raising.
Raises:

CancelledError: If the future was cancelled. TimeoutError: If the future didn’t finish executing before the given

timeout.
result(timeout=None)

Return the result of the call that the future represents.

Args:
timeout: The number of seconds to wait for the result if the future
isn’t done. If None, then there is no limit on the wait time.
Returns:
The result of the call that the future represents.
Raises:

CancelledError: If the future was cancelled. TimeoutError: If the future didn’t finish executing before the given

timeout.

Exception: If the call raised then that exception will be raised.

running()

Return True if the future is currently executing.

set_exception(exception)

Sets the result of the future as being the given exception.

Should only be used by Executor implementations and unit tests.

set_result(result)

Sets the return value of work associated with the future.

Should only be used by Executor implementations and unit tests.

set_running_or_notify_cancel()

Mark the future as running or process any cancel notifications.

Should only be used by Executor implementations and unit tests.

If the future has been cancelled (cancel() was called and returned True) then any threads waiting on the future completing (though calls to as_completed() or wait()) are notified and False is returned.

If the future was not cancelled then it is put in the running state (future calls to running() will return True) and True is returned.

This method should be called by Executor implementations before executing the work associated with this future. If this method returns False then the work should not be executed.

Returns:
False if the Future was cancelled, True otherwise.
Raises:
RuntimeError: if this method was already called or if set_result()
or set_exception() was called.
exception cbtestlib.tasks.future.TimeoutError

Bases: cbtestlib.tasks.future.Error

The operation exceeded the given deadline.

task Module

class cbtestlib.tasks.task.BucketCreateTask(server, bucket='default', replicas=1, size=0, port=11211, password=None)

Bases: cbtestlib.tasks.task.Task

check(task_manager)
execute(task_manager)
class cbtestlib.tasks.task.BucketDeleteTask(server, bucket='default')

Bases: cbtestlib.tasks.task.Task

check(task_manager)
execute(task_manager)
class cbtestlib.tasks.task.FailoverTask(servers, to_failover=[], wait_for_pending=20)

Bases: cbtestlib.tasks.task.Task

execute(task_manager)
class cbtestlib.tasks.task.GenerateExpectedViewResultsTask(doc_generators, view, query)

Bases: cbtestlib.tasks.task.Task

Task to produce the set of keys that are expected to be returned by querying the provided <view>. Results can be later passed to ViewQueryVerificationTask and compared with actual results from server.

Currently only views with map functions that emit a single string or integer as keys are accepted.

Also NOTE, this task is to be used with doc_generators that produce json like documentgenerator.DocumentGenerator

check(task_manager)
static cmp_result_rows(x, y)
execute(task_manager)
filter_emitted_rows()
generate_emitted_rows()
class cbtestlib.tasks.task.GenericLoadingTask(server, bucket, kv_store)

Bases: threading.Thread, cbtestlib.tasks.task.Task

check(task_manager)
execute(task_manager)
has_next()
next()
run()
class cbtestlib.tasks.task.LoadDocumentsTask(server, bucket, generator, kv_store, op_type, exp, flag=0)

Bases: cbtestlib.tasks.task.GenericLoadingTask

has_next()
next()
class cbtestlib.tasks.task.ModifyFragmentationConfigTask(server, config=None, bucket='default')

Bases: cbtestlib.tasks.task.Task

Given a config dictionary attempt to configure fragmentation settings. This task will override the default settings that are provided for a given <bucket>.

check(task_manager)
execute(task_manager)
class cbtestlib.tasks.task.MonitorActiveTask(server, type, target_value, wait_progress=100, num_iterations=100, wait_task=True)

Bases: cbtestlib.tasks.task.Task

Attempt to monitor active task that is available in _active_tasks API. It allows to monitor indexer, bucket compaction.

Execute function looks at _active_tasks API and tries to identifies task for monitoring and its pid by: task type(‘indexer’ , ‘bucket_compaction’, ‘view_compaction’ ) and target value (for example “_design/ddoc” for indexing, bucket “default” for bucket compaction or “_design/dev_view” for view compaction). wait_task=True means that task should be found in the first attempt otherwise, we can assume that the task has been completed( reached 100%).

Check function monitors task by pid that was identified in execute func and matches new progress result with the previous. task is failed if:

progress is not changed during num_iterations iteration new progress was gotten less then previous
task is passed and completed if:
progress reached wait_progress value task was not found by pid(believe that it’s over)
check(task_manager)
execute(task_manager)
class cbtestlib.tasks.task.MonitorViewFragmentationTask(server, design_doc_name, fragmentation_value=10, bucket='default')

Bases: cbtestlib.tasks.task.Task

Attempt to monitor fragmentation that is occurring for a given design_doc. execute stage is just for preliminary sanity checking of values and environment.

Check function looks at index file accross all nodes and attempts to calculate total fragmentation occurring by the views within the design_doc.

Note: If autocompaction is enabled and user attempts to monitor for fragmentation value higher than level at which auto_compaction kicks in a warning is sent and it is best user to use lower value as this can lead to infinite monitoring.

static aggregate_ddoc_info(rest, design_doc_name, bucket='default')
static calc_ddoc_fragmentation(rest, design_doc_name, bucket='default')
check(task_manager)
execute(task_manager)
class cbtestlib.tasks.task.NodeInitializeTask(server)

Bases: cbtestlib.tasks.task.Task

check(task_manager)
execute(task_manager)
class cbtestlib.tasks.task.RebalanceTask(servers, to_add=[], to_remove=[], do_stop=False, progress=30)

Bases: cbtestlib.tasks.task.Task

add_nodes(task_manager)
check(task_manager)
execute(task_manager)
start_rebalance(task_manager)
class cbtestlib.tasks.task.StatsWaitTask(servers, bucket, param, stat, comparison, value)

Bases: cbtestlib.tasks.task.Task

EQUAL = '=='
GREATER_THAN = '>'
GREATER_THAN_EQ = '>='
LESS_THAN = '<'
LESS_THAN_EQ = '<='
NOT_EQUAL = '!='
check(task_manager)
execute(task_manager)
class cbtestlib.tasks.task.Task(name)

Bases: cbtestlib.tasks.future.Future

check(task_manager)
execute(task_manager)
step(task_manager)
class cbtestlib.tasks.task.ValidateDataTask(server, bucket, kv_store, max_verify=None)

Bases: cbtestlib.tasks.task.GenericLoadingTask

has_next()
next()
class cbtestlib.tasks.task.VerifyRevIdTask(src_server, dest_server, bucket, kv_store, ops_perf)

Bases: cbtestlib.tasks.task.GenericLoadingTask

has_next()
next()
class cbtestlib.tasks.task.ViewCompactionTask(server, design_doc_name, bucket='default')

Bases: cbtestlib.tasks.task.Task

Executes view compaction for a given design doc. This is technicially view compaction as represented by the api and also because the fragmentation is generated by the keys emitted by map/reduce functions within views. Task will check that compaction history for design doc is incremented and if any work was really done.

check(task_manager)
execute(task_manager)
class cbtestlib.tasks.task.ViewCreateTask(server, design_doc_name, view, bucket='default')

Bases: cbtestlib.tasks.task.Task

check(task_manager)
execute(task_manager)
class cbtestlib.tasks.task.ViewDeleteTask(server, design_doc_name, view, bucket='default')

Bases: cbtestlib.tasks.task.Task

check(task_manager)
execute(task_manager)
class cbtestlib.tasks.task.ViewQueryTask(server, design_doc_name, view_name, query, expected_rows=None, bucket='default', retry_time=2)

Bases: cbtestlib.tasks.task.Task

check(task_manager)
execute(task_manager)
class cbtestlib.tasks.task.ViewQueryVerificationTask(server, design_doc_name, view_name, query, expected_rows, num_verified_docs=20, bucket='default', query_timeout=120)

Bases: cbtestlib.tasks.task.Task

  • query with stale=false

  • check for duplicates

  • check for missing docs
    • check memcached
    • check couch
check(task_manager)
check_for_duplicate_ids(expected_ids, couch_ids, err_infos)
check_for_missing_ids(expected_ids, couch_ids, err_infos)
check_for_value_corruption(err_infos)
debug_missing_items(missing_id_set)
execute(task_manager)
include_doc_integrity()
class cbtestlib.tasks.task.WorkloadTask(server, bucket, kv_store, num_ops, create, read, update, delete, exp)

Bases: cbtestlib.tasks.task.GenericLoadingTask

has_next()
next()

taskmanager Module

class cbtestlib.tasks.taskmanager.TaskManager

Bases: threading.Thread

run()
schedule(task, sleep_time=0)
shutdown(force=False)

Table Of Contents

Previous topic

remote Package

This Page