Java CoG Kit Gridshell Examples
From Java CoG Kit
Gregor von Laszewski and Robert Winch
Note: THIS IS A DRAFT
Abstract
Many Grid users are in the need of a simple shell like component in which they can execute commands that access Grid functionality and services. We have developed a Gridshell that provides UNIX like commands with special augmentations for the Grid. This not only includes the simple access to remote services, but also the inclusion of specialized options such as a group methodology that allows commands to be submitted to predefined groups. Gridshell is an extensible framework for a shell like environment written in 100% Java. Hence, it allows users to run a shell like environment easily on clients that have Java installed.
For more information contact gregor@mcs.anl.gov and rwinch@mcs.anl.gov
For support, please use our bugzilla system
Instalation
Gridshell has recently been put into cvs in src/cog/modules/gridshell. For instalation instructions, please visit the Java_CoG_Kit_CA_and_Gridshell_Install page.
Available Commands
Geting Help
To see a listing of commands type
>> help
You may type "help <command-name>" to view a listing of arguments to a command. Alternatively you can type "<command-name> --help".
>> help group >> group --help
To view a manpage for a command type "man <command-name"
>> man exec
WARNING: The current manpages are out of date. They will be updated as soon as possible.
cd
This command allows the user to change a directory.
A unix example
>> cd /usr/bin
A windows example:
>> cd /C:/WINDOWS/TEMP/
A windows example when the directory contains a space
>> cd "/C:/Documents and Settings/anluser/.ssh"
chmod
TBD
clear
This command just clears the shell's history
>> clear
close
This command will close the most recent connection. To establish a connection, you need to use the open command.
>> close
If you have no more connections you will see an error. This prevents closing the default local provider that allows the user to view local files.
>> close Command close failed. Cause: Error: can't close default connection
echo
This command allows the user to echo out a value.
>> echo "Hello"
It can be used to see a variable is set. See the set command to learn more about setting variables.
>> set world "World!"
>> echo "Hello ${world}"
Hello World
exec
The exec command allows the user to execute a command with any of the providers that support execution. It can be used with a group name specified by the group command, or a uri.
Default Credentials
This example demonstrates how to use the default credentials for GT2.
>> exec --command /bin/date --uri gt2://sunny.mcs.anl.gov
You can do the same example using the shorthand notation. The above example, and the two below exampels are equivalent.
>> exec -cu /bin/date gt2://sunny.mcs.anl.gov >> exec -uc gt2://sunny.mcs.anl.gov /bin/date
Password Authentication
To use a provider that does not support default credentials (such as ssh) you can specifiy the credentials. The example below demonstrates how to specify a password authentication. The "--password" flag signals to prompt for a password.
>> exec --command /bin/date --uri ssh://sunny.mcs.anl.gov --username anluser --password
Passphrase Authentication
In some cases the user may need to be authenticated using passphrase authentication.
Examples using passphrase authentication in linux. *NOTE: The commands should be all on one line, they have been modified so that they are easier to view.
Long Hand notation *
>> exec --command /bin/date --uri ssh://sunny.mcs.anl.gov --username anluser --password --certificate /user/anluser/.ssh/id_rsa
Short Hand notation
>> exec -cup /bin/date ssh://sunny.mcs.anl.gov anluser --certificate /user/anluser/.ssh/id_rsa
An example using passphrase authentication in windows. Note the quotes around the certificate file name. This is because there is a space in the value of "--certificate" *
>> exec -cup /bin/date ssh://sunny.mcs.anl.gov anluser --certificate "/C:/Documents and Settings/anluser/.ssh/id_rsa"
Executing Using A Group
A group is a set of uri's and credentials for the uri's. Please first visit the #group example and define the group myGroup.
>> exec --command /bin/echo --args "Hello World" --group myGroup ssh://sunny.mcs.anl.gov:8083/ Hello World ssh://smiley.mcs.anl.gov Hello World gt2://happy.mcs.anl.gov Hello World
NOTE: The order that these task completed is non-deterministic.
exit
Allows a user to exit the Gridshell
>> exit
get
TBD
getdir
TBD
gnetconfig
This command allows the user to easily configure the ipaddress for their cog.properties file. Setting the value of the ipaddress is necessary for redirected output of gram provider.
Viewing the Device Info
This feature uses java to inspect each network device's ipaddress. Note that Java does not always support inspection for some devices, such as a VPN connection. However, typically VPN connections will be seen on windows machines.
>> gnetconfig --deviceinfo Device info: Device Name: 'lo | MS TCP Loopback interface address: '/127.0.0.1 Device Name: 'eth0 | Wireless Network Adapter #2 - Packet Scheduler Miniport address: '/192.168.1.100 Device Name: 'eth1 | Fast Ethernet NIC - Packet Scheduler Miniport Device Name: 'eth2 | Cisco Systems VPN Adapter - Packet Scheduler Miniport address: '/123.456.78.910
Displaying the Current cog.properties ipaddress value
This feature allows the user to inspect the value of the ipaddress. This can be confirmed by looking at ipaddress=<value> in ~/.globus/cog.properties.
>> gnetconfig --value ipaddress: 192.168.1.1
Setting the IP Address in cog.properties
This feature allows the user to set the ipaddress in the cog.properties in one of two methods
Value of Device
One method is to specify the device that output will be redirected to.
>> gnetconfig --value ipaddress: 192.168.1.1 >> gnetconfig eth2 >> gnetconfig --value ipaddress: 123.456.78.910
Specific IP Address
The second method is to specify a specific ipaddress
>> gnetconfig --value ipaddress: 192.168.1.1 >> gnetconfig --ipaddress 123.456.78.910 >> gnetconfig --value ipaddress: 123.456.78.910
gridproxyinit
Allows a user to initialize their proxy easily. It starts up the CoG Grid Proxy Init component.
>> gridproxyinit
group
A group is a set of uri's and credentials for the uri's. In this example, a group named "myGroup" will be defined that can be used in the "Executing Using A Group" example.
Define A Group
NOTE: All of the commands below should be on one line. They have been put on two lines in order to make them more readable.
>> group --action add --group myGroup --uri ssh://sunny.mcs.anl.gov:8083/ --username anluser --password >> group --action add --group myGroup --uri gt2://happy.mcs.anl.gov >> group --action add --group myGroup --uri ssh://smiley.mcs.anl.gov --username anluser --password --certificate /home/anluser/.ssh/id_rsa
Viewing Available Groups
>> group myGroup
Viewing a Specific Group's Information
>> group --action print --group myGroup ssh://sunny.mcs.anl.gov:8083/ gt2://happy.mcs.anl.gov ssh://smiley.mcs.anl.gov
Using myGroup to Execute
You may now use this to execute. See the exec #Executing Using A Group example.
gsh
TBD
help
TBD
isdir
TBD
lpwd
TBD
ls
TBD
man
TBD
mkdir
TBD
mv
TBD
open
TBD
put
TBD
putdir
TBD
pwd
TBD
rm
TBD
rmdir
TBD
set
Allows the user to set variables.
Set the variable firstName and view it
>> set firstName Rob
>> echo ${firstName}
Rob
Set the variable lastName and view it
>> set lastName Winch
>> echo ${lastName}
Winch
View both first and last name.
>> echo "${lastName}, ${firstName}"
Winch, Rob
Setting name and view it
>> set name "${firstName} ${lastName}"
>> echo "Hello '${name}'!"
Hello 'Rob Winch'!
work
This command is to simulate that the shell can be doing lots of work and still update the display properly because commands are run in a separate thread. It has no real other purpose.
workflow
This example shows you how to start up a Java CoG Kit workflow with the karajan workflow engine. The workflow is specified in the file specification.xml.
PLEASE NOTE THIS IS NOT YET IMPLEMENTED.
workflow specification.xml
To increase the debugging level one can use the -debug flag and specify values between 0 and 5 where 5 is the higets level of debugging and 0 is no debugging.
workflow -debug specification.xml
An example for a specification.xml file can be found here ... TBD.
Examples
TBD
Adding Commands
TBD
