title: Submitting a Training Job to Google Cloud ML
body: <p>I have a code as below that I want to submit to Google cloud ml. I already tested their example and got results.</p>
  
  <pre><code>from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  
  import tensorflow as tf
  import numpy as np
  
  # Data sets
  I_TRAINING = "/home/android/Desktop/training.csv"
  I_TEST = "/home/android/Desktop/test.csv"
  
  # Load datasets.
  training_set = tf.contrib.learn.datasets.base.load_csv(filename=I_TRAINING, target_dtype=np.int)
  test_set = tf.contrib.learn.datasets.base.load_csv(filename=I_TEST, target_dtype=np.int)
  
  # Specify that all features have real-value data
  feature_columns = [tf.contrib.layers.real_valued_column("", dimension=2)]
  
  # Build 3 layer DNN with 10, 20, 10 units respectively.
  classifier = tf.contrib.learn.DNNClassifier(feature_columns=feature_columns,
                                              hidden_units=[10, 20, 10],
                                              n_classes=2,
                                              model_dir="/tmp/my_model")
  
  # Fit model.
  classifier.fit(x=training_set.data, y=training_set.target, steps=2000)
  
  # Evaluate accuracy.
  accuracy_score = classifier.evaluate(x=test_set.data, y=test_set.target)["accuracy"]
  print('Accuracy: {0:f}'.format(accuracy_score))
  
  # Classify two new flower samples.
  #new_samples = np.array(
   #   [[6.4, 3.2, 4.5, 1.5], [5.8, 3.1, 5.0, 1.7]], dtype=float)
  #y = classifier.predict(new_samples)
  #print('Predictions: {}'.format(str(y)))
  </code></pre>
  
  <p>It's a code to train and create a DNN model in tensorflow. I already tested it locally and received results. I put this code in a folder named trainer along with <strong>init</strong>.py file, and uploaded the folder to gs://bucket-ml/second_job/trainer. Second_job is the JOB_NAME.</p>
  
  <p>Then, when I want to submit this as a job, I do this and get the following error:</p>
  
  <pre><code>gcloud beta ml jobs submit training ${JOB_NAME}  \ 
  --package-path=trainer   \
  --module-name=trainer.trainer   \
  --staging-bucket="${TRAIN_BUCKET}"   \
  --region=us-central1   \
  --train_dir="${TRAIN_PATH}/train"
  
  ERROR: (gcloud.beta.ml.jobs.submit.training) 
      Packaging of user python code failed with message:
        running sdist
  running egg_info
  creating trainer.egg-info
  writing trainer.egg-info/PKG-INFO
  writing top-level names to trainer.egg-info/top_level.txt
  writing dependency_links to trainer.egg-info/dependency_links.txt
  writing manifest file 'trainer.egg-info/SOURCES.txt'
  error: package directory 'trainer' does not exist
      Try manually writing a setup.py file at your package root
      and rerunning the command
  </code></pre>
  
  <p>I am not sure if the package-path and module-name are correct. Please advise me what to do. Thanks
  Regards,</p>