Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-dev] Question about running additional commands in external tools framework

Dave,

Here's what you need to do to get the hostname from a resource manager. In the case of a serial connection, it will depend on how you've implemented the connection. If you're using RSE then you'll need to explore the gory details of RSE to find it. You might find some useful code in the org.eclipse.ptp.remote.rse.core plugin.

Cheers,

Greg

1. First, get the resource manager configuration from the resource manager:

IResourceManagerConfiguration rmConfig = rm.getConfiguration();

2. Check that the resource manager configuration is derived from an AbstractRemoteResouceManagerConfiguration:

if (rmConfig instanceof AbstractRemoteResourceManagerConfiguration) {
...
}

3. If it is, use the remote services ID to get the remote services used by this RM:

AbstractRemoteResourceManagerConfiguration remoteRMConfig = (AbstractRemoteResourceManagerConfiguration)rmConfig; IRemoteServices remoteServices = PTPRemoteCorePlugin .getRemoteServices(remoteRMConfig.getRemoteServicesId());

4. Then use the remote services to get the remote connection:

IRemoteConnection connection = remoteServices .getConnectionManager ().getConnection(remoteRMConfig.getConnectionName());

5. Finally, use the IRemoteConnection to get the remote address:

String address = connection.getAddress();


On Apr 27, 2009, at 9:49 PM, Dave Wootton wrote:


Wyatt
I tried coding another analysis step as you described and it seems to get control at the right point in time. I'm not sure how I get the host that I run the command on though. If I look at the attributes in the ILaunchConfiguration obejct my method is passed. I don't see a remote host name in there. The closest I see is the attribute for a resource manager id. I can find the resource manager by starting with the array of resource managers obtained bt referencing the PTPCorePlugin object, but I don't know how I get from resource manager to the hostname of the connection for the remote connection. I'm also not sure how I make this work in the case of a serial application where I don't think I have a resource manager to deal with.

The other thing that's happening now, and may have been happening all along, is that I see my parallel application running twice when I run the performance configuration. I'm guessing once because of the application tab in the performance configuration and then again for something in your extension.

Any idea what might be happening?
Dave


Wyatt Spear <wspear@xxxxxxxxxxxxxx>
Sent by: ptp-dev-bounces@xxxxxxxxxxx
04/24/2009 01:40 PM
Please respond to
Parallel Tools Platform general developers <ptp-dev@xxxxxxxxxxx>

To
Parallel Tools Platform general developers <ptp-dev@xxxxxxxxxxx>
cc
Subject
Re: [ptp-dev] Question about running additional commands in external tools framework





The behavior of utility commands in an execution step is different from the analysis step. In the execution step they are supposed to compose with the application being run. This is to support tools like valgrind where you actually run valgrind and give it your own executable as an argument. This means that your setup should have sent a command like

/bin/touch /tmp/plugin <your_executable>

...to the remote machine which is still not what you want. But it sounds like the framework didn't make it that far. The system does some error checking which includes making sure the path exists on the local system, which I will need to remove to support remote functionality. This same error checking currently looks at the whole string for the utility command to see if it is a valid file. If you put /tmp/plugin as an <argument value="/tmp/plugin"> to the utility, so the command string is just the executable it will get around that. But this still doesn't address your goal.

Right now the best way to run an arbitrary application is with the <analyze> tag. I need to enable remote support for you to be able to invoke remote applications with simple xml, but as a temporary measure you could specify another internal analysis step with AbstractPerformanceDataManager that uses the remote API to invoke 'touch'. You would need to put that analysis tag before your execute tag so it might bug you for the execute directory as you saw before. I'll add an attribute to tell it that it doesn't need to do that. And I'll try to implement some basic support for remote tool invocation so that kind of effort won't be necessary.

Another possibility would be to use two execute commands in a row. The second is your regular command. The first is just:

<execute>
 <utility command="touch"/>
</execute>

This will touch (not launch) the executable itself so you can check its time stamp. ...except, it will use whatever run job parameters you have already set up with your remote resource, which might not be appropriate.

-Wyatt


On Fri, Apr 24, 2009 at 6:45 AM, Dave Wootton <dwootton@xxxxxxxxxx> wrote:
Wyatt
I'm wondering if there's a way to run additional commands prior to running
my application using the performance configuration dialog and your
framework.
I tried putting
<utility command="/bin/touch /tmp/plugin"> statement in my XML file
thinking that would run the touch command on the remote system. I ended up getting a popup telling me the '\/bin/touch /tmp/plugin' tool wasn't found
so I'm guessing this was run on my local system and failed.

Is there a way I can run a remote command before running my application
using your framework that doesn't require the user to do anything? Is
there something I can code in the XML file to do this?

If not, I'll have to think about a different way to solve this since I
think this is very specific to my plugin. I'm trying to touch a file to use as a timestamp so I can find files created later than the date of the file I touched. I can't rely on time o the local system since clocks may
be out of sync.
Dave
_______________________________________________
ptp-dev mailing list
ptp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ptp-dev

_______________________________________________
ptp-dev mailing list
ptp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ptp-dev

_______________________________________________
ptp-dev mailing list
ptp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ptp-dev



Back to the top