Skip to content

Commit

Permalink
Add remote_submit capability
Browse files Browse the repository at this point in the history
  • Loading branch information
tfredian committed Apr 1, 2004
1 parent 1f9d05c commit fa4deb2
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exec_prefix=@exec_prefix@
INSTALL=@top_srcdir@/conf/install-sh -c

SCRIPTS = \
@MAKEBINDIR@remote_submit \
@MAKEBINDIR@unix_submit \
@MAKEBINDIR@synchronize_unix

Expand All @@ -20,6 +21,9 @@ install:
$(INSTALL) -m 755 $${script} @bindir@;\
done

@MAKEBINDIR@remote_submit : remote_submit
cp remote_submit @MAKEBINDIR@remote_submit

@MAKEBINDIR@unix_submit : unix_submit
cp unix_submit @MAKEBINDIR@unix_submit

Expand Down
3 changes: 3 additions & 0 deletions scripts/remote_submit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
export MDS_PATH=`pwd`\;$MDS_PATH
echo remote_submit_helper\(\"$1\",\"$2\",\"$3\"\) | tditest
7 changes: 7 additions & 0 deletions tdi/remote_submit.fun
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public fun remote_submit(in _file, optional in _host, optional in _shot)
{
if (!present(_host)) _host="any";
if (!present(_shot)) _shot=$shot;
tcl('spawn/nowait remote_submit '//_host//' '//_file//' '//_shot);
return(0);
}
62 changes: 62 additions & 0 deletions tdi/remote_submit_helper.fun
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
public fun remote_submit_helper(_host,_file,_shot)
{

/* Connect to remote mdsip server and issue a unix_submit on that server.

format: remote_submit(_host,_file,_shot)

_host = internet host name of remote system or "any" to cycle through
list of execution servers. To use the "any" feature you must
have a site-specific tdi function in the MDS_PATH called
remote_submit_queues which takes no arguments and returns an array of
host names. If the any feature is used, an index into the queues is
saved in the file: /tmp/remote_submit_idx
_file = name of the executable image or script. Must be present on the remote
system.

_shot = shot number passed to unix_submit.

*/

if (_host == "any")
{
_lun=fopen("/tmp/remote_submit_idx","r");
if (_lun == "")
_idx=-1;
else
{
_idx=execute(read(_lun));
fclose(_lun);
}
_idx += 1;
_queues = remote_submit_queues();
if (_idx >= size(_queues))
_idx = 0;
_first_queue=_idx;
_stat = 0;
while (_stat == 0)
{
_host = _queues[_idx];
write(*,"_host=",_host);
_stat = mdsconnect(_host);
if (_stat == 0)
{
_idx += 1;
if (_idx > size(_queues))
_idx = 0;
if (_first_queue == _idx)
return(0);
}
}
_lun=fopen("/tmp/remote_submit_idx","w");
write(_lun,_idx);
fclose(_lun);
}
else
_stat=mdsconnect(_host);
if (_stat > 0)
{
_stat=mdsvalue('tcl("spawn/nowait unix_submit '//_file//' '//_shot//'")');
}
return(_stat);
}

0 comments on commit fa4deb2

Please sign in to comment.