示例#1
0
  void Locality_Splitter::finalize_sub_plan (
      Deployment::DeploymentPlan &sub_plan,
      KEY &sub_plan_key)
  {
    DANCEX11_LOG_TRACE ("Locality_Splitter::finalize_sub_plan");

    // check for availability of LocalityManager instance
    if (!sub_plan_key.has_locality_manager ())
      {
        // add minimal default LocalityManager instance to sub plan
        uint32_t impl_index = sub_plan.implementation ().size ();
        sub_plan.implementation ().push_back (::Deployment::MonolithicDeploymentDescription ());
        uint32_t inst_index = sub_plan.instance ().size ();
        sub_plan.instance ().push_back (::Deployment::InstanceDeploymentDescription ());
        sub_plan.instance ().back ().implementationRef (impl_index);

        // set correct implementation type
        Deployment::Property exec_property;
        exec_property.name (IMPL_TYPE);
        exec_property.value () <<= DANCE_LOCALITYMANAGER;
        sub_plan.implementation ().back ().execParameter ().push_back (exec_property);

        // create unique name for Locality Manager
        ACE_Utils::UUID uuid;
        ACE_Utils::UUID_GENERATOR::instance ()->generate_UUID (uuid);
        std::string lm_name ("Locality Manager [");
        lm_name += uuid.to_string ()->c_str ();
        lm_name += "]";
        sub_plan.instance ().back ().name (lm_name);

        DANCEX11_LOG_TRACE ("Locality_Splitter::finalize_sub_plan - " <<
                            "No locality manager found, created a default locality named<" <<
                            sub_plan.instance ().back ().name () << ">");

        // add instance to sub plan key
        sub_plan_key.add_instance (inst_index);
        // mark as locality manager
        sub_plan_key.locality_manager_instance (
          sub_plan_key.instances ().size () - 1);
      }
  }
示例#2
0
  void Locality_Splitter::prepare_sub_plan (
      uint32_t instance,
      Deployment::DeploymentPlan &sub_plan,
      KEY &sub_plan_key)
  {
    DANCEX11_LOG_TRACE ("Locality_Splitter::prepare_sub_plan");

    // first time?
    if (sub_plan_key.uuid ().empty ())
      {
        // use UUID to uniquely identify sub plan key
        sub_plan_key.uuid (sub_plan.UUID ());
      }
    if (sub_plan_key.node () != this->plan_.instance ()[instance].node ())
      {
        // set sub plan key to node name for instance
        sub_plan_key.node (this->plan_.instance ()[instance].node ());
      }
    if (!sub_plan_key.has_instance (instance))
      {
        sub_plan_key.add_instance (instance);

        if (!sub_plan_key.has_locality_manager ())
          {
            // check if this is the LocalityManager instance
            uint32_t impl_idx =
              this->plan_.instance ()[instance].implementationRef ();

            if (impl_idx >= this->plan_.implementation ().size ())
              {
                DANCEX11_LOG_ERROR ("Locality_Splitter::prepare_sub_plan - " <<
                                    "Invalid implementation index");
              }
            else
              {
                const std::string instance_type =
                  DAnCE::Utility::get_instance_type (
                    plan_.implementation ()[impl_idx].execParameter ());
                if (!instance_type.empty ())
                  {
                    if (instance_type == DANCE_LOCALITYMANAGER)
                      {
                        // mark locality manager instance offset
                        sub_plan_key.locality_manager_instance (
                          sub_plan_key.instances ().size () - 1);

                        DANCEX11_LOG_TRACE ("Locality_Splitter::prepare_sub_plan - " <<
                                            "Found locality manager instance " <<
                                            instance << ":" << plan_.instance ()[instance].name ());
                      }
                  }
              }
          }
      }
    if (sub_plan.label ().empty ())
      {
        // derive descriptive label
        std::string sub_label ("Split plan from ");
        if (!this->plan_.label ().empty ())
          {
            sub_label += this->plan_.label ();
          }
        else
          {
            sub_label += this->plan_.UUID ();
          }
        sub_label += " for a Locality on Node ";
        sub_label += sub_plan_key.node ();
        sub_plan.label (sub_label);
      }
  }