|
| 1 | +--- |
| 2 | +title: Back up and recover your custom Text Analytics for health models |
| 3 | +titleSuffix: Azure Cognitive Services |
| 4 | +description: Learn how to save and recover your custom Text Analytics for health models. |
| 5 | +services: cognitive-services |
| 6 | +author: aahill |
| 7 | +manager: nitinme |
| 8 | +ms.service: cognitive-services |
| 9 | +ms.subservice: language-service |
| 10 | +ms.topic: conceptual |
| 11 | +ms.date: 04/25/2022 |
| 12 | +ms.author: aahi |
| 13 | +ms.custom: language-service-custom-ta4h |
| 14 | +--- |
| 15 | + |
| 16 | +# Back up and recover your custom Text Analytics for health models |
| 17 | + |
| 18 | +When you create a Language resource, you specify a region for it to be created in. From then on, your resource and all of the operations related to it take place in the specified Azure server region. It's rare, but not impossible, to encounter a network issue that affects an entire region. If your solution needs to always be available, then you should design it to fail over into another region. This requires two Azure Language resources in different regions and synchronizing custom models across them. |
| 19 | + |
| 20 | +If your app or business depends on the use of a custom Text Analytics for health model, we recommend that you create a replica of your project in an additional supported region. If a regional outage occurs, you can then access your model in the other fail-over region where you replicated your project. |
| 21 | + |
| 22 | +Replicating a project means that you export your project metadata and assets, and import them into a new project. This only makes a copy of your project settings and tagged data. You still need to [train](./train-model.md) and [deploy](./deploy-model.md) the models to be available for use with [prediction APIs](https://aka.ms/ct-runtime-swagger). |
| 23 | + |
| 24 | +In this article, you will learn to how to use the export and import APIs to replicate your project from one resource to another existing in different supported geographical regions, guidance on keeping your projects in sync and changes needed to your runtime consumption. |
| 25 | + |
| 26 | +## Prerequisites |
| 27 | + |
| 28 | +* Two Azure Language resources in different Azure regions. [Create your resources](./create-project.md#create-a-language-resource) and connect them to an Azure storage account. It's recommended that you connect each of your Language resources to different storage accounts. Each storage account should be located in the same respective regions that your separate Language resources are in. You can follow the [quickstart](../quickstart.md?pivots=rest-api#create-a-new-azure-language-resource-and-azure-storage-account) to create an additional Language resource and storage account. |
| 29 | + |
| 30 | + |
| 31 | +## Get your resource keys endpoint |
| 32 | + |
| 33 | +Use the following steps to get the keys and endpoint of your primary and secondary resources. These will be used in the following steps. |
| 34 | + |
| 35 | +[!INCLUDE [Get keys and endpoint Azure Portal](../includes/get-keys-endpoint-azure.md)] |
| 36 | + |
| 37 | +> [!TIP] |
| 38 | +> Keep a note of keys and endpoints for both primary and secondary resources as well as the primary and secondary container names. Use these values to replace the following placeholders: |
| 39 | +`{PRIMARY-ENDPOINT}`, `{PRIMARY-RESOURCE-KEY}`, `{PRIMARY-CONTAINER-NAME}`, `{SECONDARY-ENDPOINT}`, `{SECONDARY-RESOURCE-KEY}`, and `{SECONDARY-CONTAINER-NAME}`. |
| 40 | +> Also take note of your project name, your model name and your deployment name. Use these values to replace the following placeholders: `{PROJECT-NAME}`, `{MODEL-NAME}` and `{DEPLOYMENT-NAME}`. |
| 41 | +
|
| 42 | +## Export your primary project assets |
| 43 | + |
| 44 | +Start by exporting the project assets from the project in your primary resource. |
| 45 | + |
| 46 | +### Submit export job |
| 47 | + |
| 48 | +Replace the placeholders in the following request with your `{PRIMARY-ENDPOINT}` and `{PRIMARY-RESOURCE-KEY}` that you obtained in the first step. |
| 49 | + |
| 50 | +[!INCLUDE [Export project assets using the REST API](../includes/rest-api/export-project.md)] |
| 51 | + |
| 52 | +### Get export job status |
| 53 | + |
| 54 | +Replace the placeholders in the following request with your `{PRIMARY-ENDPOINT}` and `{PRIMARY-RESOURCE-KEY}` that you obtained in the first step. |
| 55 | + |
| 56 | +[!INCLUDE [Export project assets using the REST API](../includes/rest-api/get-export-status.md)] |
| 57 | + |
| 58 | + |
| 59 | +Copy the response body as you will use it as the body for the next import job. |
| 60 | + |
| 61 | +## Import to a new project |
| 62 | + |
| 63 | +Now go ahead and import the exported project assets in your new project in the secondary region so you can replicate it. |
| 64 | + |
| 65 | +### Submit import job |
| 66 | + |
| 67 | +Replace the placeholders in the following request with your `{SECONDARY-ENDPOINT}`, `{SECONDARY-RESOURCE-KEY}`, and `{SECONDARY-CONTAINER-NAME}` that you obtained in the first step. |
| 68 | + |
| 69 | +[!INCLUDE [Import project using the REST API](../includes/rest-api/import-project.md)] |
| 70 | + |
| 71 | +### Get import job status |
| 72 | + |
| 73 | +Replace the placeholders in the following request with your `{SECONDARY-ENDPOINT}` and `{SECONDARY-RESOURCE-KEY}` that you obtained in the first step. |
| 74 | + |
| 75 | +[!INCLUDE [Import project using the REST API](../includes/rest-api/get-import-status.md)] |
| 76 | + |
| 77 | + |
| 78 | +## Train your model |
| 79 | + |
| 80 | +After importing your project, you only have copied the project's assets and metadata and assets. You still need to train your model, which will incur usage on your account. |
| 81 | + |
| 82 | +### Submit training job |
| 83 | + |
| 84 | +Replace the placeholders in the following request with your `{SECONDARY-ENDPOINT}` and `{SECONDARY-RESOURCE-KEY}` that you obtained in the first step. |
| 85 | + |
| 86 | +[!INCLUDE [train model](../includes/rest-api/train-model.md)] |
| 87 | + |
| 88 | + |
| 89 | +### Get training status |
| 90 | + |
| 91 | +Replace the placeholders in the following request with your `{SECONDARY-ENDPOINT}` and `{SECONDARY-RESOURCE-KEY}` that you obtained in the first step. |
| 92 | + |
| 93 | +[!INCLUDE [get training model status](../includes/rest-api/get-training-status.md)] |
| 94 | + |
| 95 | +## Deploy your model |
| 96 | + |
| 97 | +This is the step where you make your trained model available form consumption via the [runtime prediction API](https://aka.ms/ct-runtime-swagger). |
| 98 | + |
| 99 | +> [!TIP] |
| 100 | +> Use the same deployment name as your primary project for easier maintenance and minimal changes to your system to handle redirecting your traffic. |
| 101 | +
|
| 102 | +### Submit deployment job |
| 103 | + |
| 104 | +Replace the placeholders in the following request with your `{SECONDARY-ENDPOINT}` and `{SECONDARY-RESOURCE-KEY}` that you obtained in the first step. |
| 105 | + |
| 106 | +[!INCLUDE [deploy model](../includes/rest-api/deploy-model.md)] |
| 107 | + |
| 108 | +### Get the deployment status |
| 109 | + |
| 110 | +Replace the placeholders in the following request with your `{SECONDARY-ENDPOINT}` and `{SECONDARY-RESOURCE-KEY}` that you obtained in the first step. |
| 111 | + |
| 112 | +[!INCLUDE [get deploy status](../includes/rest-api/get-deployment-status.md)] |
| 113 | + |
| 114 | +## Changes in calling the runtime |
| 115 | + |
| 116 | +Within your system, at the step where you call [runtime prediction API](https://aka.ms/ct-runtime-swagger) check for the response code returned from the submit task API. If you observe a **consistent** failure in submitting the request, this could indicate an outage in your primary region. Failure once doesn't mean an outage, it may be transient issue. Retry submitting the job through the secondary resource you have created. For the second request use your `{SECONDARY-ENDPOINT}` and `{SECONDARY-RESOURCE-KEY}`, if you have followed the steps above, `{PROJECT-NAME}` and `{DEPLOYMENT-NAME}` would be the same so no changes are required to the request body. |
| 117 | + |
| 118 | +In case you revert to using your secondary resource you will observe slight increase in latency because of the difference in regions where your model is deployed. |
| 119 | + |
| 120 | +## Check if your projects are out of sync |
| 121 | + |
| 122 | +Maintaining the freshness of both projects is an important part of the process. You need to frequently check if any updates were made to your primary project so that you move them over to your secondary project. This way if your primary region fails and you move into the secondary region you should expect similar model performance since it already contains the latest updates. Setting the frequency of checking if your projects are in sync is an important choice. We recommend that you do this check daily in order to guarantee the freshness of data in your secondary model. |
| 123 | + |
| 124 | +### Get project details |
| 125 | + |
| 126 | +Use the following url to get your project details, one of the keys returned in the body indicates the last modified date of the project. |
| 127 | +Repeat the following step twice, one for your primary project and another for your secondary project and compare the timestamp returned for both of them to check if they are out of sync. |
| 128 | + |
| 129 | + [!INCLUDE [get project details](../includes/rest-api/get-project-details.md)] |
| 130 | + |
| 131 | + |
| 132 | +Repeat the same steps for your replicated project using `{SECONDARY-ENDPOINT}` and `{SECONDARY-RESOURCE-KEY}`. Compare the returned `lastModifiedDateTime` from both projects. If your primary project was modified sooner than your secondary one, you need to repeat the steps of [exporting](#export-your-primary-project-assets), [importing](#import-to-a-new-project), [training](#train-your-model) and [deploying](#deploy-your-model). |
| 133 | + |
| 134 | + |
| 135 | +## Next steps |
| 136 | + |
| 137 | +In this article, you have learned how to use the export and import APIs to replicate your project to a secondary Language resource in other region. Next, explore the API reference docs to see what else you can do with authoring APIs. |
| 138 | + |
| 139 | +* [Authoring REST API reference](https://aka.ms/ct-authoring-swagger) |
| 140 | + |
| 141 | +* [Runtime prediction REST API reference](https://aka.ms/ct-runtime-swagger) |
0 commit comments