def test_tasks_register(self): class MyClass(object): def mymethod1(self): pass def mymethod2(self): pass def mymethod3(self): pass from djangotasks.models import register_task try: register_task(MyClass.mymethod3, None, MyClass.mymethod1, MyClass.mymethod2) register_task(MyClass.mymethod1, '''Some documentation''', MyClass.mymethod2) register_task(MyClass.mymethod2, '''Some other documentation''') self.assertEquals([('mymethod3', '', 'mymethod1,mymethod2'), ('mymethod1', 'Some documentation', 'mymethod2'), ('mymethod2', 'Some other documentation', '')], TaskManager.DEFINED_TASKS['djangotasks.tests.MyClass']) finally: del TaskManager.DEFINED_TASKS['djangotasks.tests.MyClass']
ec2_ebs_volume = models.ForeignKey('Ec2EbsVolume') creation_time = models.DateTimeField() destruction_time = models.DateTimeField(blank=True, null=True) snapshot_id = models.CharField(max_length = 20) class Ec2Instance(models.Model): """ A Cluster Node or other EC2 Instance These will get created when a cluster is launched with the information coming from the StarCluster Node instances. """ cluster_instance = models.ForeignKey('ClusterInstance') instance_type = models.ForeignKey('Ec2InstanceType') alias = models.CharField(max_length = 32) arch = models.CharField(max_length = 32) instance_id = models.CharField(max_length = 16) image_id = models.CharField(max_length = 16) launch_time = models.DateTimeField() termination_time = models.DateTimeField(blank=True, null=True) placement = models.CharField(max_length = 32) ip_address = models.IPAddressField() dns_name = models.CharField(max_length = 256) private_ip_address = models.IPAddressField() public_dns_name = models.CharField(max_length = 256) state = models.CharField(max_length = 16) # Register Django Background Tasks register_task(Disk.make_initial_snapshot, '''Creates the initial Snapshot.''') register_task(ClusterInstance.launch, '''Launches the Cluster.''') register_task(ClusterInstance.terminate, '''Terminates the Cluster.''')
destruction_time = models.DateTimeField(blank=True, null=True) snapshot_id = models.CharField(max_length=20) class Ec2Instance(models.Model): """ A Cluster Node or other EC2 Instance These will get created when a cluster is launched with the information coming from the StarCluster Node instances. """ cluster_instance = models.ForeignKey('ClusterInstance') instance_type = models.ForeignKey('Ec2InstanceType') alias = models.CharField(max_length=32) arch = models.CharField(max_length=32) instance_id = models.CharField(max_length=16) image_id = models.CharField(max_length=16) launch_time = models.DateTimeField() termination_time = models.DateTimeField(blank=True, null=True) placement = models.CharField(max_length=32) ip_address = models.IPAddressField() dns_name = models.CharField(max_length=256) private_ip_address = models.IPAddressField() public_dns_name = models.CharField(max_length=256) state = models.CharField(max_length=16) # Register Django Background Tasks register_task(Disk.make_initial_snapshot, '''Creates the initial Snapshot.''') register_task(ClusterInstance.launch, '''Launches the Cluster.''') register_task(ClusterInstance.terminate, '''Terminates the Cluster.''')