<commit_before>/*
 * server.js: Azure Server
 *
 * (C) Microsoft Open Technologies, Inc.
 *
 */

var utile = require('utile'),
    base  = require('../../core/compute/server');

var Server = exports.Server = function Server(client, details) {
  base.Server.call(this, client, details);
  this.requestPending = false;
};

utile.inherits(Server, base.Server);

Server.prototype._setProperties = function (details) {
  var roleInstance = null;

  details = details || {};
  this.id   = details.Name || "";
  this.name   = details.Name || "";

  if(details.RoleInstanceList && details.RoleInstanceList.RoleInstance) {
    roleInstance = details.RoleInstanceList.RoleInstance;
  }

  console.log("Status: " + details.Status + ' RoleInstanceList: ' + roleInstance ? roleInstance.InstanceStatus : 'UNKNOWN');

  // azure returns very inconsistent RoleInstance status so we check everything.
  // an azure vm has a complicated state machine. We need to check the status of both the deployment and the role.
  // azure first starts a deployment and then starts a role. The role seems to go through STOPPEDVM, PROVISIONING and then
  // READYROLE.
  // Note: since we have to wait until azure responds to our createdDeployment request, we most likely will miss all of the
  // deployment states.
  // TODO: there doesn't seem to be an ERROR or FAIL status in pkgcloud

  if(roleInstance) {
    switch (roleInstance.InstanceStatus.toUpperCase()) {
      case 'PROVISIONING':
      case 'CREATINGVM':
      case 'STARTINGVM':
      case 'CREATINGROLE':
      case 'STARTINGROLE':
      case 'RESTARTINGROLE':
      case 'BUSYROLE':
      case 'INITIALIZING':
      case 'BUSY':<commit_msg>removed console.log<commit_after>/*
 * server.js: Azure Server
 *
 * (C) Microsoft Open Technologies, Inc.
 *
 */

var utile = require('utile'),
    base  = require('../../core/compute/server');

var Server = exports.Server = function Server(client, details) {
  base.Server.call(this, client, details);
  this.requestPending = false;
};

utile.inherits(Server, base.Server);

Server.prototype._setProperties = function (details) {
  var roleInstance = null;

  details = details || {};
  this.id   = details.Name || "";
  this.name   = details.Name || "";

  if(details.RoleInstanceList && details.RoleInstanceList.RoleInstance) {
    roleInstance = details.RoleInstanceList.RoleInstance;
  }

  //console.log("Status: " + details.Status + ' RoleInstanceList: ' + roleInstance ? roleInstance.InstanceStatus : 'UNKNOWN');

  // azure returns very inconsistent RoleInstance status so we check everything.
  // an azure vm has a complicated state machine. We need to check the status of both the deployment and the role.
  // azure first starts a deployment and then starts a role. The role seems to go through STOPPEDVM, PROVISIONING and then
  // READYROLE.
  // Note: since we have to wait until azure responds to our createdDeployment request, we most likely will miss all of the
  // deployment states.
  // TODO: there doesn't seem to be an ERROR or FAIL status in pkgcloud

  if(roleInstance) {
    switch (roleInstance.InstanceStatus.toUpperCase()) {
      case 'PROVISIONING':
      case 'CREATINGVM':
      case 'STARTINGVM':
      case 'CREATINGROLE':
      case 'STARTINGROLE':
      case 'RESTARTINGROLE':
      case 'BUSYROLE':
      case 'INITIALIZING':
      case 'BUSY':
{'fraction_non_alphanumeric': 0.111540749553837, 'fraction_numerical': 0.0, 'mean_word_length': 3.454304635761589, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4921675', 'n_tokens_mistral': 985, 'n_tokens_neox': 961, 'n_words': 316}