bootstrap-vz/bootstrapvz/base/task.py

39 lines
865 B
Python
Raw Normal View History

2013-05-02 19:13:35 +02:00
class Task(object):
2014-03-23 19:37:25 +01:00
"""The task class represents a task that can be run.
2014-03-23 16:04:03 +01:00
It is merely a wrapper for the run function and should never be instantiated.
"""
# The phase this task is located in.
phase = None
2014-03-23 16:04:03 +01:00
# List of tasks that should run before this task is run
predecessors = []
2014-03-23 16:04:03 +01:00
# List of tasks that should run after this task has run
successors = []
2013-05-02 19:13:35 +02:00
class __metaclass__(type):
2014-03-23 16:04:03 +01:00
"""Metaclass to control how the class is coerced into a string
"""
def __repr__(cls):
2014-03-23 16:04:03 +01:00
"""
Returns:
string.
"""
return '{module}.{task}'.format(module=cls.__module__, task=cls.__name__)
def __str__(cls):
2014-03-23 16:04:03 +01:00
"""
Returns:
string.
"""
return repr(cls)
@classmethod
def run(cls, info):
2014-03-23 16:04:03 +01:00
"""The run function, all work is done inside this function
2014-03-23 19:37:25 +01:00
:param info: The bootstrap info object.
:type info: BootstrapInformation
2014-03-23 16:04:03 +01:00
"""
pass