bootstrap-vz/bootstrapvz/base/task.py

38 lines
855 B
Python
Raw Normal View History

2013-05-02 19:13:35 +02:00
class Task(object):
2014-03-23 16:04:03 +01:00
"""The task class represents are task that can be run.
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
Args:
info (BootstrapInformation): The bootstrap info object
"""
pass