use of com.microsoft.intellij.deploy.AzureDeploymentProgressNotification in project azure-tools-for-java by Microsoft.
the class DockerContainerDeployTask method run.
@Override
public void run(@NotNull final ProgressIndicator indicator) {
openViews(project);
AzurePlugin.removeUnNecessaryListener();
DeploymentEventListener deployListnr = new DeploymentEventListener() {
@Override
public void onDeploymentStep(DeploymentEventArgs args) {
indicator.setFraction(args.getDeployCompleteness() / 100.0);
indicator.setText(AzureBundle.message("deployingToAzure"));
indicator.setText2(args.toString());
}
};
AzurePlugin.addDeploymentEventListener(deployListnr);
AzurePlugin.depEveList.add(deployListnr);
new AzureDeploymentProgressNotification(project).deployToDockerContainer(dockerImageInstance, url);
new Thread("Warm up the target site") {
public void run() {
try {
LOG.info("To warm the site up - implicitly trying to connect it");
WebAppUtils.sendGet(url);
} catch (Exception ex) {
LOG.info(ex.getMessage(), ex);
}
}
}.start();
}
use of com.microsoft.intellij.deploy.AzureDeploymentProgressNotification in project azure-tools-for-java by Microsoft.
the class WebAppDeployDialog method deploy.
private void deploy() {
DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
int selectedRow = table.getSelectedRow();
WebAppDetails wad = webAppWebAppDetailsMap.get(tableModel.getValueAt(selectedRow, 0));
WebApp webApp = wad.webApp;
boolean isDeployToRoot = deployToRootCheckBox.isSelected();
ProgressManager.getInstance().run(new Task.Backgroundable(project, "Deploy Web App Progress", true) {
@Override
public void run(@NotNull ProgressIndicator progressIndicator) {
AzureDeploymentProgressNotification azureDeploymentProgressNotification = new AzureDeploymentProgressNotification(project);
try {
progressIndicator.setIndeterminate(true);
PublishingProfile pp = webApp.getPublishingProfile();
Date startDate = new Date();
azureDeploymentProgressNotification.notifyProgress(webApp.name(), startDate, null, 5, "Deploying Web App...");
WebAppUtils.deployArtifact(artifact.getName(), artifact.getOutputFilePath(), pp, isDeployToRoot, new UpdateProgressIndicator(progressIndicator));
String sitePath = buildSiteLink(wad.webApp, isDeployToRoot ? null : artifact.getName());
progressIndicator.setText("Checking Web App availability...");
progressIndicator.setText2("Link: " + sitePath);
azureDeploymentProgressNotification.notifyProgress(webApp.name(), startDate, sitePath, 75, "Checking Web App availability...");
int stepLimit = 5;
int sleepMs = 2000;
// to make warn up cancelable
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
for (int step = 0; step < stepLimit; ++step) {
if (WebAppUtils.isUrlAccessible(sitePath)) {
// warm up
break;
}
Thread.sleep(sleepMs);
}
} catch (Exception e) {
e.printStackTrace();
LOGGER.error("deploy::warmup", e);
}
}
});
thread.start();
while (thread.isAlive()) {
if (progressIndicator.isCanceled())
return;
else
Thread.sleep(sleepMs);
}
azureDeploymentProgressNotification.notifyProgress(webApp.name(), startDate, sitePath, 100, message("runStatus"));
showLink(sitePath);
} catch (IOException | InterruptedException ex) {
ex.printStackTrace();
//LOGGER.error("deploy", ex);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
ErrorWindow.show(project, ex.getMessage(), "Deploy Web App Error");
}
});
}
}
});
}
Aggregations