Beispiel #1
0
 def create_resource(self, name, **kwargs):
     if self.is_live:
         self.client = create_batchai_client(self)
         group = self._get_resource_group(**kwargs)
         self.resource = create_cluster(
             self.client, self.location, group.name, name, self.vm_size,
             self.target_nodes,
             self._get_storage_account(**kwargs).name,
             self._get_storage_account_key(**kwargs))
         if self.wait:
             wait_for_nodes(self.is_live, self.client, group.name, name,
                            self.target_nodes, NODE_STARTUP_TIMEOUT_SEC)
     else:
         self.resource = models.Cluster()
         self.resource.id = models.ResourceId(id='fake')
     return {self.parameter_name: self.resource}
Beispiel #2
0
 def create_resource(self, name, **kwargs):
     if self.is_live:
         self.client = Helpers.create_batchai_client(self)
         group = self._get_resource_group(**kwargs)
         self.resource = Helpers.create_cluster(
             self.client, self.location, group.name, name, self.vm_size,
             self.target_nodes,
             self._get_storage_account(**kwargs).name,
             self._get_storage_account_key(**kwargs))
         self.client.experiments.create(
             group.name, Helpers.DEFAULT_WORKSPACE_NAME,
             Helpers.DEFAULT_EXPERIMENT_NAME).result()
         if self.wait:
             Helpers.wait_for_nodes(self.is_live, self.client, group.name,
                                    name, self.target_nodes,
                                    Helpers.NODE_STARTUP_TIMEOUT_SEC)
     else:
         self.resource = models.Cluster()
         self.resource.id = models.ResourceId(id='fake')
     return {self.parameter_name: self.resource}