Commit 1c435ab5 authored by js9's avatar js9
Browse files

splitting host profile into machine and launch profiles

having host profiles saved individually, and outside of config files


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@9916 18c085ea-50e0-402c-830e-de6fd14e8384
parent 676b6654
......@@ -199,7 +199,8 @@ state/GaussianControlPoint.C
state/GaussianControlPointList.C
state/GlobalAttributes.C
state/GlobalLineoutAttributes.C
state/HostProfile.C
state/LaunchProfile.C
state/MachineProfile.C
state/HostProfileList.C
state/InteractorAttributes.C
state/InternalResampleAttributes.C
......
......@@ -117,11 +117,14 @@ ExistingRemoteProcess::~ExistingRemoteProcess()
// Jeremy Meredith, Thu May 24 11:10:15 EDT 2007
// Added SSH tunneling argument; pass it along to CreateCommandLine.
//
// Jeremy Meredith, Thu Feb 18 15:25:27 EST 2010
// Split HostProfile int MachineProfile and LaunchProfile.
//
// ****************************************************************************
bool
ExistingRemoteProcess::Open(const std::string &rHost,
HostProfile::ClientHostDetermination chd,
MachineProfile::ClientHostDetermination chd,
const std::string &clientHostName,
bool manualSSHPort,
int sshPort, bool useTunneling,
......
......@@ -68,6 +68,9 @@
// Jeremy Meredith, Thu May 24 11:10:15 EDT 2007
// Added SSH tunneling argument to Open.
//
// Jeremy Meredith, Thu Feb 18 15:25:27 EST 2010
// Split HostProfile int MachineProfile and LaunchProfile.
//
// ****************************************************************************
class COMM_API ExistingRemoteProcess : public RemoteProcess
......@@ -76,7 +79,7 @@ public:
ExistingRemoteProcess(const std::string &rProgram);
virtual ~ExistingRemoteProcess();
virtual bool Open(const std::string &rHost,
HostProfile::ClientHostDetermination chd,
MachineProfile::ClientHostDetermination chd,
const std::string &clientHostName,
bool manualSSHPort,
int sshPort, bool useTunneling,
......
......@@ -1142,11 +1142,14 @@ RemoteProcess::Launch(const std::string &rHost, bool createAsThoughLocal,
// Brad Whitlock, Thu Apr 9 10:40:08 PDT 2009
// I moved some code to the new Launch method.
//
// Jeremy Meredith, Thu Feb 18 15:25:27 EST 2010
// Split HostProfile int MachineProfile and LaunchProfile.
//
// ****************************************************************************
bool
RemoteProcess::Open(const std::string &rHost,
HostProfile::ClientHostDetermination chd,
MachineProfile::ClientHostDetermination chd,
const std::string &clientHostName,
bool manualSSHPort,
int sshPort,
......@@ -1775,11 +1778,14 @@ RemoteProcess::SecureShellArgs() const
// 7 (on UNIX) or 10 (on Windows). Particularly on Windows, users were
// still having problems.
//
// Jeremy Meredith, Thu Feb 18 15:25:27 EST 2010
// Split HostProfile int MachineProfile and LaunchProfile.
//
// ****************************************************************************
void
RemoteProcess::CreateCommandLine(stringVector &args, const std::string &rHost,
HostProfile::ClientHostDetermination chd,
MachineProfile::ClientHostDetermination chd,
const std::string &clientHostName,
bool manualSSHPort,
int sshPort,
......@@ -1966,15 +1972,15 @@ RemoteProcess::CreateCommandLine(stringVector &args, const std::string &rHost,
// the host name, and use the actual listen port number.
switch (chd)
{
case HostProfile::MachineName:
case MachineProfile::MachineName:
args.push_back("-host");
args.push_back(localHost.c_str());
break;
case HostProfile::ManuallySpecified:
case MachineProfile::ManuallySpecified:
args.push_back("-host");
args.push_back(clientHostName);
break;
case HostProfile::ParsedFromSSHCLIENT:
case MachineProfile::ParsedFromSSHCLIENT:
args.push_back("-guesshost");
break;
}
......
......@@ -47,7 +47,7 @@
#include <netinet/in.h>
#endif
#include <vectortypes.h>
#include <HostProfile.h>
#include <MachineProfile.h>
#include <map>
class Connection;
......@@ -119,6 +119,9 @@ class Connection;
// Thomas R. Treadway, Mon Oct 8 13:27:42 PDT 2007
// Backing out SSH tunneling on Panther (MacOS X 10.3)
//
// Jeremy Meredith, Thu Feb 18 15:25:27 EST 2010
// Split HostProfile int MachineProfile and LaunchProfile.
//
// ****************************************************************************
class COMM_API RemoteProcess
......@@ -127,7 +130,7 @@ public:
RemoteProcess(const std::string &rProgram);
virtual ~RemoteProcess();
virtual bool Open(const std::string &rHost,
HostProfile::ClientHostDetermination chd,
MachineProfile::ClientHostDetermination chd,
const std::string &clientHostName,
bool manualSSHPort,
int sshPort,
......@@ -160,7 +163,7 @@ protected:
bool CallProgressCallback(int stage);
bool HostIsLocal(const std::string &rHost) const;
void CreateCommandLine(stringVector &args, const std::string &rHost,
HostProfile::ClientHostDetermination chd,
MachineProfile::ClientHostDetermination chd,
const std::string &clientHostName,
bool manualSSHPort,
int sshPort, bool useTunneling,
......
......@@ -346,6 +346,60 @@ GetSystemVisItRCFile()
return retVal;
}
// ****************************************************************************
// Method: GetAndMakeUserVisItHostsDirectory
//
// Purpose:
// Returns the path to the user's .visit directory's
// host subdirectory.
//
// Arguments:
// none
//
// Programmer: Jeremy Meredith
// Creation: February 18, 2010
//
// ****************************************************************************
std::string
GetAndMakeUserVisItHostsDirectory()
{
std::string retval = GetUserVisItDirectory() + "hosts";
#if defined(_WIN32)
mkdir(retval.c_str());
#else
mkdir(retval.c_str(), 0777);
#endif
return retval;
}
// ****************************************************************************
// Method: GetAndMakeUserVisItHostsDirectory
//
// Purpose:
// Returns the path to the visit installation directory's
// host subdirectory.
//
// Arguments:
// none
//
// Programmer: Jeremy Meredith
// Creation: February 18, 2010
//
// ****************************************************************************
std::string
GetAndMakeSystemVisItHostsDirectory()
{
const char *defConfig = GetDefaultConfigFile("hosts", "VISITHOME");
std::string retVal(defConfig);
delete [] defConfig;
#if defined(_WIN32)
mkdir(retVal.c_str());
#else
mkdir(retVal.c_str(), 0777);
#endif
return retVal;
}
#if defined(_WIN32)
// ***************************************************************************
//
......
......@@ -63,6 +63,9 @@ MISC_API char * GetSystemConfigFile(const char *filename = 0);
std::string MISC_API GetUserVisItRCFile();
std::string MISC_API GetSystemVisItRCFile();
std::string MISC_API GetAndMakeUserVisItHostsDirectory();
std::string MISC_API GetAndMakeSystemVisItHostsDirectory();
int MISC_API ConfigStateGetRunCount(ConfigStateEnum &code);
void MISC_API ConfigStateIncrementRunCount(ConfigStateEnum &code);
......
......@@ -39,7 +39,6 @@
#include <RemoteProxyBase.h>
#include <RemoteProcess.h>
#include <ExistingRemoteProcess.h>
#include <HostProfile.h>
#include <snprintf.h>
// ****************************************************************************
......@@ -123,11 +122,14 @@ RemoteProxyBase::~RemoteProxyBase()
// Brad Whitlock, Fri Dec 7 16:50:17 PST 2007
// Moved RPC creation into the SetupAllRPCs method.
//
// Jeremy Meredith, Thu Feb 18 15:25:27 EST 2010
// Split HostProfile int MachineProfile and LaunchProfile.
//
// ****************************************************************************
void
RemoteProxyBase::Create(const std::string &hostName,
HostProfile::ClientHostDetermination chd,
MachineProfile::ClientHostDetermination chd,
const std::string &clientHostName,
bool manualSSHPort,
int sshPort,
......@@ -389,19 +391,25 @@ RemoteProxyBase::AddArgument(const std::string &arg)
// Always add -noloopback for parallel launches, since they may
// occur on compute nodes.
//
// Jeremy Meredith, Thu Feb 18 15:25:27 EST 2010
// Split HostProfile int MachineProfile and LaunchProfile.
// Added a new "directory" argument outside of the arbitrary args.
//
// ****************************************************************************
void
RemoteProxyBase::AddProfileArguments(const HostProfile &profile,
bool addParallelArgs)
RemoteProxyBase::AddProfileArguments(const MachineProfile &machine,
bool addParallelArgs)
{
const LaunchProfile &profile = *(machine.GetActiveLaunchProfile());
//
// Set the user's login name.
//
#if defined(_WIN32) && defined(GetUserName)
#undef GetUserName
#endif
SetRemoteUserName(profile.GetUserName());
SetRemoteUserName(machine.GetUserName());
//
// Add the parallel arguments.
......@@ -554,6 +562,13 @@ RemoteProxyBase::AddProfileArguments(const HostProfile &profile,
AddArgument("-timeout");
AddArgument(temp);
// Add the directory arugmnet
if (machine.GetDirectory() != "")
{
AddArgument("-dir");
AddArgument(machine.GetDirectory());
}
//
// Add any additional arguments specified in the profile
//
......
......@@ -43,11 +43,11 @@
#include <KeepAliveRPC.h>
#include <QuitRPC.h>
#include <ConnectCallback.h>
#include <HostProfile.h>
#include <LaunchProfile.h>
#include <MachineProfile.h>
#include <string>
// Forward declaration.
class HostProfile;
class RemoteProcess;
// ****************************************************************************
......@@ -87,6 +87,9 @@ class RemoteProcess;
// Brad Whitlock, Fri Dec 7 16:58:33 PST 2007
// Added SetupAllRPCs and GetXfer.
//
// Jeremy Meredith, Thu Feb 18 15:25:27 EST 2010
// Split HostProfile int MachineProfile and LaunchProfile.
//
// ****************************************************************************
class PROXYBASE_API RemoteProxyBase
......@@ -98,10 +101,11 @@ public:
void SetRemoteUserName(const std::string &rName);
void SetProgressCallback(bool (*cb)(void *, int), void *data);
void AddArgument(const std::string &arg);
void AddProfileArguments(const HostProfile &profile, bool addParallelArgs);
void AddProfileArguments(const MachineProfile &machine,
bool addParallelArgs);
void Create(const std::string &hostName,
HostProfile::ClientHostDetermination chd,
MachineProfile::ClientHostDetermination chd,
const std::string &clientHostName,
bool manualSSHPort,
int sshPort,
......
This diff is collapsed.
This diff is collapsed.
......@@ -40,7 +40,9 @@
#define HOSTPROFILELIST_H
#include <state_exports.h>
#include <AttributeSubject.h>
class HostProfile;
class MachineProfile;
#include <LaunchProfile.h>
// ****************************************************************************
// Class: HostProfileList
......@@ -60,13 +62,23 @@ class HostProfile;
class STATE_API HostProfileList : public AttributeSubject
{
public:
// These constructors are for objects of this class
HostProfileList();
HostProfileList(const HostProfileList &obj);
protected:
// These constructors are for objects derived from this class
HostProfileList(private_tmfs_t tmfs);
HostProfileList(const HostProfileList &obj, private_tmfs_t tmfs);
public:
virtual ~HostProfileList();
virtual HostProfileList& operator = (const HostProfileList &obj);
virtual bool operator == (const HostProfileList &obj) const;
virtual bool operator != (const HostProfileList &obj) const;
private:
void Init();
void Copy(const HostProfileList &obj);
public:
virtual const std::string TypeName() const;
virtual bool CopyAttributes(const AttributeGroup *);
......@@ -75,15 +87,13 @@ public:
// Property selection methods
virtual void SelectAll();
void SelectProfiles();
void SelectMachines();
// Property setting methods
void SetActiveProfile(int activeProfile_);
// Property getting methods
const AttributeGroupVector &GetProfiles() const;
AttributeGroupVector &GetProfiles();
int GetActiveProfile() const;
const AttributeGroupVector &GetMachines() const;
AttributeGroupVector &GetMachines();
// Persistence methods
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
......@@ -91,15 +101,15 @@ public:
// Attributegroup convenience methods
void AddProfiles(const HostProfile &);
void ClearProfiles();
void RemoveProfiles(int i);
int GetNumProfiles() const;
HostProfile &GetProfiles(int i);
const HostProfile &GetProfiles(int i) const;
void AddMachines(const MachineProfile &);
void ClearMachines();
void RemoveMachines(int i);
int GetNumMachines() const;
MachineProfile &GetMachines(int i);
const MachineProfile &GetMachines(int i) const;
HostProfile &operator [] (int i);
const HostProfile &operator [] (int i) const;
MachineProfile &operator [] (int i);
const MachineProfile &operator [] (int i) const;
// Keyframing methods
......@@ -109,31 +119,24 @@ public:
virtual bool FieldsEqual(int index, const AttributeGroup *rhs) const;
// User-defined methods
void MarkHostProfiles();
void MarkActiveProfile();
const HostProfile *GetProfileForHost(const std::string &hostName) const;
const HostProfile *FindMatchingProfileForHost(const std::string &hostName) const;
std::vector<const HostProfile*> FindAllMatchingProfileForHost(const std::string &hostName) const;
int GetNumProfilesForHost(const std::string &hostName) const;
void SetAsActiveProfile(int index);
void RemoveActiveProfile();
void ChangeHostForActiveProfile(const std::string &newHost);
virtual void ProcessOldVersions(DataNode *parentNode, const char *configVersion);
LaunchProfile *GetActiveLaunchProfileForHost(const std::string &hostName) const;
MachineProfile *GetMachineProfileForHost(const std::string &hostName) const;
// IDs that can be used to identify fields in case statements
enum {
ID_profiles = 0,
ID_activeProfile
ID_machines = 0,
ID__LAST
};
protected:
AttributeGroup *CreateSubAttributeGroup(int index);
private:
AttributeGroupVector profiles;
int activeProfile;
AttributeGroupVector machines;
// Static class format string for type map.
static const char *TypeMapFormatString;
static const private_tmfs_t TmfsStruct;
};
#define HOSTPROFILELIST_TMFS "a*"
#endif
<?xml version="1.0"?>
<Attribute name="HostProfileList" codefile="HostProfileList.code" purpose="This class contains a list of host profiles." exportAPI="STATE_API" exportInclude="state_exports.h">
<Field name="profiles" type="attVector" subtype="HostProfile"></Field>
<Field name="activeProfile" type="int">-1</Field>
<Function name="SetFromNode" user="false"></Function>
<Function name="MarkHostProfiles" user="true"></Function>
<Function name="MarkActiveProfile" user="true"></Function>
<Function name="GetProfileForHost" user="true"></Function>
<Function name="FindMatchingProfileForHost" user="true"></Function>
<Function name="FindAllMatchingProfileForHost" user="true"></Function>
<Function name="GetNumProfilesForHost" user="true"></Function>
<Function name="SetAsActiveProfile" user="true"></Function>
<Function name="RemoveActiveProfile" user="true"></Function>
<Function name="ChangeHostForActiveProfile" user="true"></Function>
<Function name="ProcessOldVersions" user="true" member="true"></Function>
<Attribute name="HostProfileList" purpose="This class contains a list of host profiles." persistent="true" keyframe="true" exportAPI="STATE_API" exportInclude="state_exports.h" codefile="HostProfileList.code">
<Field name="machines" label="machines" type="attVector" subtype="MachineProfile">
</Field>
<Function name="GetActiveLaunchProfileForHost" user="true" member="true">
</Function>
<Function name="GetMachineProfileForHost" user="true" member="true">
</Function>
<Include file="header" quoted="false">
LaunchProfile.h
</Include>
</Attribute>
......@@ -36,17 +36,18 @@
*
*****************************************************************************/
#ifndef HOSTPROFILE_H
#define HOSTPROFILE_H
#ifndef LAUNCHPROFILE_H
#define LAUNCHPROFILE_H
#include <state_exports.h>
#include <string>
#include <AttributeSubject.h>
// ****************************************************************************
// Class: HostProfile
// Class: LaunchProfile
//
// Purpose:
// This class contains information needed to launch a remote,VisIt engine.
// This class contains information needed to launch a VisIt engine.
//
// Notes: Autogenerated by xml2atts.
//
......@@ -57,23 +58,26 @@
//
// ****************************************************************************
class STATE_API HostProfile : public AttributeSubject
class STATE_API LaunchProfile : public AttributeSubject
{
public:
enum ClientHostDetermination
{
MachineName,
ManuallySpecified,
ParsedFromSSHCLIENT
};
HostProfile();
HostProfile(const HostProfile &obj);
virtual ~HostProfile();
// These constructors are for objects of this class
LaunchProfile();
LaunchProfile(const LaunchProfile &obj);
protected:
// These constructors are for objects derived from this class
LaunchProfile(private_tmfs_t tmfs);
LaunchProfile(const LaunchProfile &obj, private_tmfs_t tmfs);
public:
virtual ~LaunchProfile();
virtual HostProfile& operator = (const HostProfile &obj);
virtual bool operator == (const HostProfile &obj) const;
virtual bool operator != (const HostProfile &obj) const;
virtual LaunchProfile& operator = (const LaunchProfile &obj);
virtual bool operator == (const LaunchProfile &obj) const;
virtual bool operator != (const LaunchProfile &obj) const;
private:
void Init();
void Copy(const LaunchProfile &obj);
public:
virtual const std::string TypeName() const;
virtual bool CopyAttributes(const AttributeGroup *);
......@@ -83,8 +87,6 @@ public:
// Property selection methods
virtual void SelectAll();
void SelectProfileName();
void SelectHost();
void SelectUserName();
void SelectPartition();
void SelectBank();
void SelectTimeLimit();
......@@ -94,17 +96,12 @@ public:
void SelectSublaunchArgs();
void SelectSublaunchPreCmd();
void SelectSublaunchPostCmd();
void SelectHostAliases();
void SelectHostNickname();
void SelectManualClientHostName();
void SelectMachinefile();
void SelectHwAccelPreCommand();
void SelectHwAccelPostCommand();
// Property setting methods
void SetProfileName(const std::string &profileName_);
void SetHost(const std::string &host_);
void SetUserName(const std::string &userName_);
void SetTimeout(int timeout_);
void SetNumProcessors(int numProcessors_);
void SetNumNodesSet(bool numNodesSet_);
......@@ -130,13 +127,6 @@ public:
void SetSublaunchPreCmd(const std::string &sublaunchPreCmd_);
void SetSublaunchPostCmdSet(bool sublaunchPostCmdSet_);
void SetSublaunchPostCmd(const std::string &sublaunchPostCmd_);
void SetHostAliases(const std::string &hostAliases_);
void SetHostNickname(const std::string &hostNickname_);
void SetShareOneBatchJob(bool shareOneBatchJob_);
void SetSshPortSpecified(bool sshPortSpecified_);
void SetSshPort(int sshPort_);
void SetClientHostDetermination(ClientHostDetermination clientHostDetermination_);
void SetManualClientHostName(const std::string &manualClientHostName_);
void SetMachinefileSet(bool machinefileSet_);
void SetMachinefile(const std::string &machinefile_);
void SetVisitSetsUpEnv(bool visitSetsUpEnv_);
......@@ -145,15 +135,10 @@ public:
void SetHwAccelPreCommand(const std::string &hwAccelPreCommand_);
void SetHavePostCommand(bool havePostCommand_);
void SetHwAccelPostCommand(const std::string &hwAccelPostCommand_);
void SetTunnelSSH(bool tunnelSSH_);
// Property getting methods
const std::string &GetProfileName() const;
std::string &GetProfileName();
const std::string &GetHost() const;
std::string &GetHost();
const std::string &GetUserName() const;
std::string &GetUserName();
int GetTimeout() const;
int GetNumProcessors() const;
bool GetNumNodesSet() const;
......@@ -188,16 +173,6 @@ public:
bool GetSublaunchPostCmdSet() const;
const std::string &GetSublaunchPostCmd() const;
std::string &GetSublaunchPostCmd();
const std::string &GetHostAliases() const;
std::string &GetHostAliases();
const std::string &GetHostNickname() const;
std::string &GetHostNickname();
bool GetShareOneBatchJob() const;
bool GetSshPortSpecified() const;
int GetSshPort() const;
ClientHostDetermination GetClientHostDetermination() const;
const std::string &GetManualClientHostName() const;
std::string &GetManualClientHostName();
bool GetMachinefileSet() const;
const std::string &GetMachinefile() const;
std::string &GetMachinefile();
......@@ -209,18 +184,11 @@ public:
bool GetHavePostCommand() const;
const std::string &GetHwAccelPostCommand() const;
std::string &GetHwAccelPostCommand();
bool GetTunnelSSH() const;
// Persistence methods
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
virtual void SetFromNode(DataNode *node);
// Enum conversion functions
static std::string ClientHostDetermination_ToString(ClientHostDetermination);
static bool ClientHostDetermination_FromString(const std::string &, ClientHostDetermination &);
protected:
static std::string ClientHostDetermination_ToString(int);
public:
// Keyframing methods
virtual std::string GetFieldName(int index) const;
......@@ -228,20 +196,10 @@ public:
virtual std::string GetFieldTypeName(int index) const;
virtual bool FieldsEqual(int index, const AttributeGroup *rhs) const;