//! if the resource is a cluster:
//! internal protocol to use to start a remote container (ssh or rsh) on the cluster
string iprotocol;
+
+ //! Specify if the resource is a cluster head;
+ boolean is_cluster_head;
+
+ //! Predefined working directory on the resource
+ string working_directory;
};
//! exception thrown if a computer is not found in the catalog
test_user_commands = "userCommands";
test_use = "use";
test_members = "members";
+ test_is_cluster_head = "isClusterHead";
+ test_working_directory = "workingDirectory";
}
//=============================================================================
xmlFree(nb_of_proc_per_node);
}
+ if (xmlHasProp(machine_descr, (const xmlChar*)test_is_cluster_head))
+ {
+ xmlChar* is_cluster_head = xmlGetProp(machine_descr, (const xmlChar*)test_is_cluster_head);
+ std::string str_ich = (const char*)is_cluster_head;
+ if (str_ich == "true")
+ {
+ resource.is_cluster_head = true;
+ }
+ else
+ {
+ resource.is_cluster_head = false;
+ }
+ xmlFree(is_cluster_head);
+ }
+ else
+ {
+ resource.is_cluster_head = false;
+ }
+
+ if (xmlHasProp(machine_descr, (const xmlChar*)test_working_directory))
+ {
+ xmlChar* working_directory = xmlGetProp(machine_descr, (const xmlChar*)test_working_directory);
+ resource.working_directory = (const char*)working_directory;
+ xmlFree(working_directory);
+ }
+ else
+ {
+ resource.working_directory = "";
+ }
+
// Process children nodes
xmlNodePtr aCurSubNode = machine_descr->xmlChildrenNode;
while(aCurSubNode != NULL)
xmlNewProp(node,
BAD_CAST test_cluster_internal_protocol,
BAD_CAST ParserResourcesType::protocolToString((*iter).second.ClusterInternalProtocol).c_str());
+ xmlNewProp(node, BAD_CAST test_working_directory, BAD_CAST (*iter).second.working_directory.c_str());
+ if ((*iter).second.is_cluster_head)
+ xmlNewProp(node, BAD_CAST test_is_cluster_head, BAD_CAST "true");
+ else
+ xmlNewProp(node, BAD_CAST test_is_cluster_head, BAD_CAST "false");
switch ((*iter).second.Mode)
{
const char *test_user_commands;
const char *test_use;
const char *test_members;
+ const char *test_is_cluster_head;
+ const char *test_working_directory;
};
"use : " << use << std::endl <<
"NbOfProc : " << nbOfProc << std::endl <<
"Modules : " << std::endl <<
- "Components : " << std::endl;
+ "Components : " << std::endl <<
+ "Is Cluster Head: " << is_cluster_head << std::endl <<
+ "Working Directory: " << working_directory << std::endl;
for(unsigned int i=0;i<ComponentsList.size();i++)
oss << "Component " << i+1 << " called : " << ComponentsList[i] << std::endl;
use = "";
ClusterMembersList.clear();
nbOfProc = 1;
+ is_cluster_head = false;
+ working_directory = "";
DataForSort._Name = "";
DataForSort._nbOfNodes = 1;
std::string use;
std::list<ParserResourcesClusterMembersType> ClusterMembersList;
unsigned int nbOfProc;
+ bool is_cluster_head;
+ std::string working_directory;
void Print();
void Clear();
p_ptr->cpu_clock = resource.DataForSort._CPUFreqMHz;
p_ptr->nb_proc_per_node = resource.DataForSort._nbOfProcPerNode;
p_ptr->nb_node = resource.DataForSort._nbOfNodes;
+ p_ptr->is_cluster_head = resource.is_cluster_head;
+ p_ptr->working_directory = CORBA::string_dup(resource.working_directory.c_str());
if( resource.mpi == lam )
p_ptr->mpiImpl = "lam";
resource.DataForSort._nbOfNodes = new_resource.nb_node;
resource.DataForSort._nbOfProcPerNode = new_resource.nb_proc_per_node;
resource.UserName = new_resource.username.in();
+ resource.is_cluster_head = new_resource.is_cluster_head;
+ resource.working_directory = new_resource.working_directory.in();
std::string aBatch = new_resource.batch.in();
if (aBatch == "pbs")
}
}
-void
+void
SALOME_ResourcesManager::RemoveResource(const char * resource_name,
- CORBA::Boolean write,
- const char * xml_file)
+ CORBA::Boolean write,
+ const char * xml_file)
{
_rm.DeleteResourceInCatalog(resource_name);
if (write)
// Creating machine file
machine_file_name = tmpnam(NULL);
- std::ofstream machine_file(machine_file_name.c_str(), std::ios_base::out);
+ std::ofstream machine_file(machine_file_name.c_str(), std::ios_base::out);
CORBA::Long machine_number = 0;
std::list<std::string>::iterator it = list_of_machines.begin();
}
else if (resource.mpi == openmpi)
{
- // Creating machine file
- machine_file_name = tmpnam(NULL);
- std::ofstream machine_file(machine_file_name.c_str(), std::ios_base::out);
-
- // We add all cluster machines to the file
- std::list<ParserResourcesClusterMembersType>::iterator cluster_it =
- resource.ClusterMembersList.begin();
- while (cluster_it != resource.ClusterMembersList.end())
- {
- unsigned int number_of_proc = (*cluster_it).DataForSort._nbOfNodes *
- (*cluster_it).DataForSort._nbOfProcPerNode;
- machine_file << (*cluster_it).HostName << " slots=" << number_of_proc << std::endl;
- cluster_it++;
- }
+ // Creating machine file
+ machine_file_name = tmpnam(NULL);
+ std::ofstream machine_file(machine_file_name.c_str(), std::ios_base::out);
+
+ // We add all cluster machines to the file
+ std::list<ParserResourcesClusterMembersType>::iterator cluster_it =
+ resource.ClusterMembersList.begin();
+ while (cluster_it != resource.ClusterMembersList.end())
+ {
+ unsigned int number_of_proc = (*cluster_it).DataForSort._nbOfNodes *
+ (*cluster_it).DataForSort._nbOfProcPerNode;
+ machine_file << (*cluster_it).HostName << " slots=" << number_of_proc << std::endl;
+ cluster_it++;
+ }
}
else if (resource.mpi == nompi)
{