def delete_tf_job(self, name, namespace): """Delete the provided TFJob in the specified namespace. :param name: The custom object :param namespace: The custom resource :returns: object: The deleted TFJob. """ tfjob_client = TFJobClient() return tfjob_client.delete(name, namespace=namespace)
def delete_tf_job(self, name, namespace): """Delete the provided TFJob in the specified namespace. :param name: The custom object :param namespace: The custom resource :returns: object: The deleted TFJob. """ tfjob_client = TFJobClient( config_file=self.config_file, context=self.context, client_configuration=self.client_configuration, persist_config=self.persist_config) return tfjob_client.delete(name, namespace=namespace)
def create_tf_job(self, namespace, tfjob): """Create the provided TFJob in the specified namespace. The TFJob version is defined in TF_JOB_VERSION in fairing.constants. The version TFJob need to be installed before creating the TFJob. :param namespace: The custom resource :param tfjob: The JSON schema of the Resource to create :returns: object: Created TFJob. """ tfjob_client = TFJobClient() try: return tfjob_client.create(tfjob, namespace=namespace) except client.rest.ApiException: raise RuntimeError( "Failed to create TFJob. Perhaps the CRD TFJob version " "{} in not installed(If you use different version you can pass it " "as ENV variable called " "`TF_JOB_VERSION`)?".format(constants.TF_JOB_VERSION))
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os from kubernetes.client import V1PodTemplateSpec from kubernetes.client import V1ObjectMeta from kubernetes.client import V1PodSpec from kubernetes.client import V1Container from kubeflow.tfjob import V1ReplicaSpec from kubeflow.tfjob import V1TFJob from kubeflow.tfjob import V1TFJobSpec from kubeflow.tfjob import TFJobClient TFJOB_CLIENT = TFJobClient(config_file=os.getenv('KUBECONFIG')) SDK_TEST_NAMESPACE = 'default' def test_sdk_e2e(): container = V1Container( name="tensorflow", image="gcr.io/kubeflow-ci/tf-mnist-with-summaries:1.0", command=[ "python", "/var/tf_mnist/mnist_with_summaries.py", "--log_dir=/train/logs", "--learning_rate=0.01", "--batch_size=150" ]) worker = V1ReplicaSpec( replicas=1,