Dilium client

Client to request node and launch browser.

Dilium client

class dilium_client.client.Client(dilium_url)[source]

Client for Dilium server to get node.

Parameters:dilium_url (str) – URL to dilium server.
acquire_host(host, duration)[source]

Confirm host acquisition.

Parameters:
  • host (str) – Acquired host IP.
  • duration (int) – Duration of acquisition in seconds.
browser_name

Name of browser on acquired host.

get_node(capabilities, duration=600)[source]

Get node with browser according to requested capabilities.

Parameters:
  • capabilities (dict) – Requested browser|node capabilities
  • duration (int, optional) – Duration of acquisition in seconds.
Returns:

Remote node with browser.

Return type:

Node

host

Acquired host.

release_host()[source]

Release acquired host.

request_host(capabilities)[source]

Request host with desired capabilities.

Parameters:capabilities (dict) – Desired host capabilities.
Returns:Available host IP.
Return type:str

Dilium node

class dilium_client.node.Node(client)[source]

Remote node with requested browser.

Parameters:client (Client) – Dilium client.
capture_video(width, height)[source]

Capture video in context.

Parameters:
  • width (int) – Video width.
  • height (int) – Video height.
download_video(file_path=None)[source]

Download captured video.

Parameters:file_path (str, optional) – Path to download video.
Returns:Path of downloaded video.
Return type:str
get_browser(*args, **kwgs)[source]

Get browser on node.

Parameters:
  • *args (optional) – *args of browser instantiation.
  • **kwgs (optional) – **kwgs of browser instantiation.
inside_xvfb(width, height)[source]

Launch virtual display in context.

Parameters:
  • width (int) – Screen width.
  • height (int) – Screen height.
remote_exec

Remote ansible executor.

start_video(width, height)[source]

Start video capturing.

Parameters:
  • width (int) – Video width.
  • height (int) – Video height.
start_webdriver()[source]

Start remote webdriver.

start_xvfb(width, height)[source]

Start virtual display.

Parameters:
  • width (int) – Screen width.
  • height (int) – Screen height.
stop_video()[source]

Stop video capturing.

stop_webdriver()[source]

Stop remote webdriver.

stop_xvfb()[source]

Stop virtual display.

video_path

Remote path to captured video.

webdriver_url

Launched webdriver url.

Dilium errors

exception dilium_client.errors.DiliumError[source]

Dilium Error.

Dilium utils

dilium_client.utils.get_pid(ansible_result)[source]

Get process ID from ansible result of remote async command.

dilium_client.utils.wrap_async(cmd)[source]

Wrap shell command to async execution command.

Chrome wrapper

class dilium_client._selenium.chrome.Chrome(node, chrome_options=None, desired_capabilities=None)[source]

Chrome wrapper for remote launching.

Parameters:
  • node (Node) – Remote node with chrome browser.
  • chrome_options (object, optional) – Chrome options.
  • desired_capabilities (dict, optional) – Desired chrome capabilities.
launch()[source]

Launch chrome browser.

quit()[source]

Quit chrome browser.

Dilium ansible executor

class dilium_client._ansible.executor.Executor(*hosts, **options)[source]

Remote commands executor via ansible.

Parameters:
  • *hosts (optional) – Sequence of hosts where commands will be executed. As minimum one host should be passed
  • **options (optional) – Options for ansible. Full sequence is described in Options section.
__call__(cmd, async=False)[source]

Execute shell command.

_exec(task)[source]

Execute ansible task.

avconv(file_path, display, width=800, height=600, frame_rate=30, codec='libx264', options=None)[source]

Launch avconv on remote host.

download(src, dst, flat=True)[source]

Download file from remote to local host.

kill(pid, sig=2)[source]

Send signal to process on remote host.

webdriver(command, env=None, log_path='/dev/null')[source]

Launch webdriver on remote host.

xvfb(display, width=800, height=600, depth=24, options=None)[source]

Launch xvfb on remote host.

Dilium ansible options

class dilium_client._ansible.options.Options(verbosity=None, inventory=None, listhosts=None, subset=None, module_paths=None, extra_vars=None, forks=None, ask_vault_pass=None, vault_password_files=None, new_vault_password_file=None, output_file=None, tags=None, skip_tags=None, one_line=None, tree=None, ask_sudo_pass=None, ask_su_pass=None, sudo=None, sudo_user=None, become=None, become_method=None, become_user=None, become_ask_pass=None, ask_pass=None, private_key_file=None, remote_user=None, connection=None, timeout=None, ssh_common_args=None, sftp_extra_args=None, scp_extra_args=None, ssh_extra_args=None, poll_interval=None, seconds=None, check=None, syntax=None, diff=None, force_handlers=None, flush_cache=None, listtasks=None, listtags=None, module_path=None)[source]

Options for ansible.

Dilium ansible callback

class dilium_client._ansible.callback.Callback(bucket, display=None)[source]

Callback to process result of ansible execution.

Parameters:
  • bucket (list) – Bucket to put execution results.
  • display (Display, optional) – Ansible Display.
_store(result, status)[source]

Store result in bucket.

v2_runner_on_failed(result, ignore_errors=False)[source]

Process execution result on failed.

v2_runner_on_ok(result)[source]

Process execution result on ok.

v2_runner_on_skipped(result)[source]

Process execution result on skipped.

v2_runner_on_unreachable(result)[source]

Process execution result on unreachable.

class dilium_client._ansible.callback.Response(host, status, task, payload)
__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

__getstate__()

Exclude the OrderedDict from pickling

__repr__()

Return a nicely formatted representation string

_asdict()

Return a new OrderedDict which maps field names to their values

classmethod _make(iterable, new=<built-in method __new__ of type object at 0x9192c0>, len=<built-in function len>)

Make a new Response object from a sequence or iterable

_replace(_self, **kwds)

Return a new Response object replacing specified fields with new values

host

Alias for field number 0

payload

Alias for field number 3

status

Alias for field number 1

task

Alias for field number 2

Ansible module for avconv

Usage example:

task = {
    'avconv': {
        'rate': frame_rate,
        'width': width,
        'height': height,
        'display': display,
        'codec': codec,
        'options': options,
        'file': file_path
    }
}

Ansible module for webdriver

Usage example:

task = {
    'webdriver': {
        'command': command,
        'log_file': log_path,
        'env': env
    }
}

Ansible module for xvfb

Usage example:

task = {
    'xvfb': {
        'display': display,
        'width': width,
        'height': height,
        'depth': depth,
        'options': options
    }
}