Tasker.control¶
API for the tasker module.
the tasker.control module contains the api to generate projects and work with tasks.
Example:
>>> import tasker.control
>>> import tasker.templates
>>> tasker.control.new_project(name='test_project')
>>> project = tasker.control.get_project_by_name('test_project')
>>> project.new_asset(name='baum_a')
>>> project.new_shot(name='01_010')
>>> assets = project.assets
>>> baum_a = None
>>> for asset in assets:
>>> if 'baum_a' in asset.name:
>>> baum_a = asset
>>> modeling = baum_a.get_task_by_name(name=tasker.templates.modeling)
>>> tasker.control.new_user(name='user1')
>>> user = tasker.control.get_user_by_name(name='user1')
>>> modeling.user=user
>>> state = modeling.state
-
class
tasker.control.Asset(model)¶ Use this class to associate assets to shots, layouts, tasks and projects.
An asset is a representation of an unit of work for a movie. For example: Tree_a is an asset. This asset may include some polygonal data, some texture maps and even some animation etc which are all associated via folder structures or some database to this asset. To complete an asset, different deparments and tasks are infolved which can/may be representet as task.
-
class
tasker.control.Comment(model)¶ A Comment is associated with a task change and holds the test entered by the user.
-
class
tasker.control.Project(model)¶ A Project holds tasks, assets and shots. Is is also used for interaction with those. Use a project object to generate and interact with task, asstes and shots.
-
assets¶ Gets the assets associated with the current project.
Returns: A list of Asset instances for the current project. Return type: list(Asset)
-
layouts¶ Get the layouts associated with this project.
Returns: layout instances for all layouts in the current project. Return type: list(Layouts)
-
new_asset(name, template)¶ Creates a new asset with the given name in the project. The new shot will use the provided template to generate tasks and dependenciesfor itself.
Parameters: - name (str) – name of the new asset. Aborts if an asset with this name already exists.
- template (dict) – A configuration file to generate tasks and dependencies for the new asset from.
-
new_shot(name, template)¶ Creates a shot for this project. The new shot will use the provided template to generate tasks and dependencies for itself.
Parameters: - name (str) – name of the new shot. Aborts if a shot with this name already exists.
- template (dict) – A configuration file to generate tasks and dependencies for the new shot from.
-
shots¶ Get the shots associated with this project.
Returns: Shot instances for all shots in the current project. Return type: list(Shot)
-
-
class
tasker.control.Task(model)¶ A ask is a single unit of process and may be chained together with other tasks via dependencies. Also a user can be associated with it and subtasks may be added. A task may be linked against a shot or asset where it belongs to.
-
add_comment(text)¶ Associates a new comment with this task.
Parameters: text (str) – comment for this task
-
child_tasks¶ All child / subtasks which belong to this task.
Returns: all child tasks Return type: list(Task)
-
comments¶ All comments associated with this tasks. Normaly entered during state changes.
Returns: All comments for this task. Return type: list(Comment)
-
is_state_allowed(state)¶ Checks if the task may change its state to the given one.
Parameters: state (str) – name of the new state Returns: True if state change is allowed. Otherwise False. Return type: bool
-
state¶ The current state of the task. :returns: current state :rtype: str
-
update_tasks_states()¶ Updates states for this tasks and all dependencies. If a task state is set, other depending tasks may be ready to start. This method update tose and also the database entries.
-
-
class
tasker.control.TaskHolder(model)¶ Base class which provides methods to work with tasks.
-
delete()¶ Removes this asset from the database and deassociates all asset tasks from the assigned user.
Returns: True if deleteoin was successfull, False otherwise. Return type: bool
-
-
class
tasker.control.User(model)¶ Allows assignment and querying of assignd tasks.
-
tasker.control.get_all_projects()¶ All projects available in the database.
Returns: all projects available in the database Return type: list(Project)
-
tasker.control.get_all_tasks(user=None, state=None)¶ All tasks in the database. Optional for the given user and/or state.
Parameters: - user (User) – tasks must be assigned to this user to be returned.
- state (str) – tasks must have this state to be returned.
Returns: all task matching the criteria.
Return type: list(Task)
-
tasker.control.get_all_users()¶ Returns all users in the database.
Returns: all users in the database Return type: list(User)
-
tasker.control.get_project_by_name(name)¶ Returns a project instance for the given name if it exists in the database.
Parameters: name (str) – project to find and return Returns: instance for the given name if exists. Otherwise None Return type: Project
-
tasker.control.get_task_templates_by_category_name(category)¶ Get the task templates defined in tasker.templates for the given categorie.
Parameters: category (str) – ‘shot’ or ‘asset’ Returns: of registered templates for the given category Return type: dict
-
tasker.control.get_user_by_name(name)¶ Find a user in the database by it’s name. Queries the database for the username. If it exists it’s returned otherwise a ValueError is raised. :param name: username to search for :type name: str
Returns: the user with the given name. Return type: User
-
tasker.control.new_project(name)¶ Creates a new project with the given name.
Create a project to hold tasks, assets and shots. :param name: name of the new project :type name: str
-
tasker.control.new_user(name)¶ Creates a new user in the databse. Creates a new user with the given name in the database. If a user with this name exists already creation is skipped. :param name: name of the new user. :type name: str