title: Luis programmatically train and publish
body: <p>Ive been trying to programmatically train and publish Luis model based on <a href="https://westus.dev.cognitive.microsoft.com/docs/services/5890b47c39e2bb17b84a55ff/operations/5890b47c39e2bb052c5b9c3b" rel="nofollow noreferrer">https://westus.dev.cognitive.microsoft.com/docs/services/5890b47c39e2bb17b84a55ff/operations/5890b47c39e2bb052c5b9c3b</a>. </p>
  
  <p>Ive multiple Luis app to be trained and my current flow is :</p>
  
  <ol>
  <li><p>Post the app to be trained - queued status</p></li>
  <li><p>Get the training status based on a single model/intent ( Check if a single intent has completed the training )</p></li>
  <li><p>If the intent training is completed, without considering other intent, proceed with publish.</p></li>
  </ol>
  
  <p>My question over here is that if the other model in a Luis app havent completed training - that means, its still in progress, can the Luis app published? </p>
  
  <p>Im getting the following json result for Spanish - Could not load model. Please re-train your application.</p>
  
  <pre><code>Requested training status For Spanish
  [
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:38Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:38Z"
        }
     },
     {
        "modelId": "40c607ab-ce31-46ac-b67c-61168d21b7d0",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:38Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:38Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:38Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:42Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:41Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 3,
           "status": "InProgress",
           "exampleCount": 1052
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:38Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:38Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:38Z"
        }
     }
  ]
  Publishing Application For Spanish
  Inside Publish Application Action For Spanish
  Sending Request
  Response Received
  Completed Publishing Application For Spanish
  {
     "error": {
        "code": "ModelLoadFailed",
        "message": "Could not load model. Please re-train your application."
     }
  }
  </code></pre>
  
  <p>The following for Chinese app - Sequence contains no elements</p>
  
  <pre><code>Requested training status For Chinese
  [
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:56Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:56Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:56Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:56Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:56Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:58Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:57Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:56Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 3,
           "status": "InProgress",
           "exampleCount": 1052
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:53Z"
        }
     },
     {
        "modelId": "",
        "details": {
           "statusId": 0,
           "status": "Success",
           "exampleCount": 1052,
           "trainingDateTime": "2018-07-11T02:01:56Z"
        }
     }
  ]
  Publishing Application For Chinese
  Inside Publish Application Action For Chinese
  Sending Request
  Response Received
  Completed Publishing Application For Chinese
  {
     "error": {
        "code": "BadArgument",
        "message": "Sequence contains no elements"
     }
  }
  </code></pre>