talus package

Submodules

talus.api module

class talus.api.TalusClient(api_base='http://localhost:8001')[source]

Bases: object

An api client that will communicate with Talus

code_create(code_name, code_type)[source]

Create the code, and return the results

code_find(name_or_id, **search)[source]
code_iter(type_=None)[source]

Return an iterator that iterates over all existing Code models in Talus :returns: iterator

image_configure(image_id_or_name, vagrantfile=None, user_interaction=False)[source]

Configure the image with id image_id. An instance of the image will be spun up which you can then configure. Shutting down the image will commit any changes.

Image_id_or_name:
 The id or name of the image that is to be configured
Vagrantfile:The contents of a vagrantfile that is to be used to configure the image
User_interaction:
 If the user should be given a chance to manually interact
Returns:The configured image
image_create(image_name, base_image_id_or_name, os_id, desc='', tags=None, vagrantfile=None, user_interaction=False)[source]

Create a new VM image based on an existing image.

Image_name:The name of the new VM image (to be created)
Base_image_id_or_name:
 The id or name of the base image
Os_id:The id of the operating system
Desc:A description of the new image
Tags:A list of tags associated with the new image
Vagrantfile:The Vagrantfile to run when creating the new image
User_interaction:
 Allow user interaction to occur (vs automatically shutting down the VM after the vagrantfile is run)
Returns:The created image
image_delete(image_id_or_name)[source]

Delete the image with id image_id or name name

Image_id:The id of the image to delete
Returns:None
image_import(image_path, image_name, os_id, desc='desc', tags=None, username='user', password='password', file_id=None)[source]

TODO: Docstring for import_image.

Image_path:The path to the image to be uploaded
Image_name:The name of the resulting image
Os_id:The id or name of the operating system document (string)
Desc:A description of the image
Tags:An array of tags associated with this VM image (e.g. [“browser”, “ie”, “ie10”, “windows”])
Username:The username to be used in the image
Password:The password associated with the username
File_id:The id of the file that has already been uploaded to the server
Returns:The configured image
image_iter()[source]

Return an iterator that iterates over all existing images in Talus :returns: iterator over all existing images

job_cancel(job_name_or_id)[source]

Cancel the job job_name_or_id in talus

Job_name_or_id:The job name or id to cancel
job_create(task_name_or_id, image, name=None, params=None, priority=50, queue='jobs', limit=1, network='whitelist')[source]

Create a new job (run a task)

job_iter(**search)[source]

Iterate through all of the jobs

Search:optional search parameters
os_delete(os_id)[source]

Delete an os by os_id which may be the id or name

Os_id:The name or id of the os to delete
os_iter()[source]

Return an iterator that iterates over all existing OS models in Talus :returns: iterator

result_iter(**search)[source]

Iterate through result matching the search criteria

Search:optional search parameters
slave_iter(**search)[source]

Iterate through all of the slaves

Search:optional search parameters
task_create(name, tool_id, params, version=None, limit=1)[source]

Create a new task with the supplied arguments

Name:The name of the task
Tool_id:The id or name of the tool the task will run
Params:A dict of params for the task
Version:The version of code to use. None defaults to the HEAD version (default: None)
Limit:The default limit of any jobs that use this task
Returns:The task model
task_delete(task_id)[source]

Delete a task by task_id which may be the id or name

Task_id:The name or id of the task to delete
task_iter()[source]

Return an iterator that iterates over all existing Task models in Talus :returns: iterator

talus.errors module

exception talus.errors.TalusApiError(msg, error=None, *args, **kwargs)[source]

Bases: exceptions.Exception

talus.models module

class talus.models.Code(api_base='http://localhost:8000', **fields)[source]

Bases: talus.models.TalusModel

The model for Tools/Components

api_path = 'api/code'
fields = {'name': <talus.models.Field object at 0x2b893303e290>, 'bases': <talus.models.Field object at 0x2b893303ea50>, 'params': <talus.models.Field object at 0x2b893303eb50>, 'timestamps': <talus.models.Field object at 0x2b893303e310>, 'type': <talus.models.Field object at 0x2b893303e950>, 'desc': <talus.models.Field object at 0x2b893303ea90>}
class talus.models.Field(default_value=None, details=False)[source]

Bases: object

dup()[source]
get_val()[source]
class talus.models.Image(api_base='http://localhost:8000', **fields)[source]

Bases: talus.models.TalusModel

The model for Image API objects

api_path = 'api/image'
fields = {'status': <talus.models.Field object at 0x2b893303eb90>, 'username': <talus.models.Field object at 0x2b893303e810>, 'base_image': <talus.models.RefField object at 0x2b893303e350>, 'name': <talus.models.Field object at 0x2b893303ead0>, 'tags': <talus.models.Field object at 0x2b893303e3d0>, 'timestamps': <talus.models.Field object at 0x2b893303e390>, 'password': <talus.models.Field object at 0x2b893303e9d0>, 'os': <talus.models.RefField object at 0x2b893303ea10>, 'md5': <talus.models.Field object at 0x2b893303ec50>, 'desc': <talus.models.Field object at 0x2b893303eb10>}
class talus.models.Job(api_base='http://localhost:8000', **fields)[source]

Bases: talus.models.TalusModel

The model for running tasks (“Jobs”)

api_path = 'api/job'
fields = {'status': <talus.models.Field object at 0x2b893303e090>, 'image': <talus.models.RefField object at 0x2b893303e2d0>, 'timestamps': <talus.models.Field object at 0x2b893303e0d0>, 'limit': <talus.models.Field object at 0x2b893303e190>, 'network': <talus.models.Field object at 0x2b893303e250>, 'queue': <talus.models.Field object at 0x2b893303e210>, 'task': <talus.models.RefField object at 0x2b89330c3fd0>, 'name': <talus.models.Field object at 0x2b89330c3f90>, 'priority': <talus.models.Field object at 0x2b893303e110>, 'params': <talus.models.Field object at 0x2b893303e050>, 'progress': <talus.models.Field object at 0x2b893303e1d0>}
class talus.models.OS(api_base='http://localhost:8000', **fields)[source]

Bases: talus.models.TalusModel

The model for OS API objects

api_path = 'api/os'
fields = {'arch': <talus.models.Field object at 0x2b893303e8d0>, 'version': <talus.models.Field object at 0x2b893303e850>, 'type': <talus.models.Field object at 0x2b893303e890>, 'name': <talus.models.Field object at 0x2b893303e550>}
class talus.models.RefField(default_value=None, details=False)[source]

Bases: talus.models.Field

get_val()[source]
class talus.models.Result(api_base='http://localhost:8000', **fields)[source]

Bases: talus.models.TalusModel

The model for Result objects

api_path = 'api/result'
fields = {'data': <talus.models.Field object at 0x2b893303ebd0>, 'job': <talus.models.RefField object at 0x2b893303e990>, 'type': <talus.models.Field object at 0x2b893303e490>, 'tool': <talus.models.Field object at 0x2b893303e6d0>, 'created': <talus.models.Field object at 0x2b893303e650>}
class talus.models.Slave(api_base='http://localhost:8000', **fields)[source]

Bases: talus.models.TalusModel

The model for Slave API objects – intended to be READ ONLY

api_path = 'api/slave'
fields = {'max_vms': <talus.models.Field object at 0x2b893303e750>, 'uuid': <talus.models.Field object at 0x2b893303e790>, 'ip': <talus.models.Field object at 0x2b893303e710>, 'hostname': <talus.models.Field object at 0x2b893303e690>, 'running_vms': <talus.models.Field object at 0x2b893303e7d0>, 'total_jobs_run': <talus.models.Field object at 0x2b893303ec10>, 'vms': <talus.models.Field object at 0x2b893303ee90>}
class talus.models.TalusModel(api_base='http://localhost:8000', **fields)[source]

Bases: object

The baseclass for Talus API models

api_path = ''
classmethod api_url(base)[source]

Add the base path and the model’s api_path together

clear_id()[source]
delete()[source]

Delete this model

fields = {}
classmethod find_one(api_base=None, **search)[source]

Return the first matching model, or None if none matched

Api_base:The base of the api url, If None, models.API_BASE will be used
**searchsearch:The search params
Returns:The matched model or None
classmethod headers()[source]
classmethod objects(api_base=None, **search)[source]

Return a list of models

Api_base:The base of the api url. If none, models.API_BASE will be used
**searchsearch:search params
Returns:A list of models
classmethod objects_raw(api_base=None, **search)[source]

Return a list of json objects

Api_base:The base of the api url. If none, models.API_BASE will be used
**searchsearch:search params
Returns:A list of models as json objects (raw)
refresh()[source]

Refresh the current model

save()[source]

Save this model’s fields

class talus.models.Task(api_base='http://localhost:8000', **fields)[source]

Bases: talus.models.TalusModel

The model for Tasks

api_path = 'api/task'
fields = {'name': <talus.models.Field object at 0x2b89330c3d90>, 'tool': <talus.models.RefField object at 0x2b89330c3e10>, 'version': <talus.models.Field object at 0x2b89330c3ed0>, 'limit': <talus.models.Field object at 0x2b89330c3f50>, 'params': <talus.models.Field object at 0x2b89330c3e90>, 'timestamps': <talus.models.Field object at 0x2b89330c3f10>}
talus.models.set_base(new_base)[source]

talus.utils module

talus.utils.json_request(method, *args, **params)[source]

Module contents