From 94ef96dd7f8b8b701655ebce689958b86f484ef2 Mon Sep 17 00:00:00 2001 From: mwinkel-dev <122583770+mwinkel-dev@users.noreply.github.com> Date: Thu, 20 Mar 2025 12:08:46 -0600 Subject: [PATCH 1/3] Fix: remote_submit_helper.fun now accepts zero id and has a timeout --- tdi/remote/remote_submit_helper.fun | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tdi/remote/remote_submit_helper.fun b/tdi/remote/remote_submit_helper.fun index a113cc9fd8..0b36845c62 100644 --- a/tdi/remote/remote_submit_helper.fun +++ b/tdi/remote/remote_submit_helper.fun @@ -20,17 +20,25 @@ public fun remote_submit_helper(_host,_file,_shot) if (_host == "any") { _queues = remote_submit_queues(); - _stat = 0; - while (_stat == 0) + + _start = cvttime(); + _elapsed = 0; + _max_seconds = 300; + _invalid_id = -1; + + /* Note that mdsconnect() returns a connection id, not a status code */ + _stat = _invalid_id; + while ((_stat == _invalid_id) AND (_elapsed < _max_seconds)) { _host = _queues[long(random()*size(_queues))]; write(*,"Trying ",_host); _stat = mdsconnect(_host); + _elapsed = cvttime() - _start; } } else _stat=mdsconnect(_host); - if (_stat > 0) + if (_stat > _invalid_id) { _stat=mdsvalue('tcl("spawn/nowait unix_submit '//_file//' '//_shot//'")'); } else { From b557898f596d17e4b43d24451b53dce6715f0bca Mon Sep 17 00:00:00 2001 From: mwinkel-dev <122583770+mwinkel-dev@users.noreply.github.com> Date: Thu, 20 Mar 2025 15:26:57 -0600 Subject: [PATCH 2/3] Fix: MdsConnect.fun now has correct check for invalid connection id --- tdi/remote/MdsConnect.fun | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tdi/remote/MdsConnect.fun b/tdi/remote/MdsConnect.fun index f64cd602bc..1c17208cbd 100644 --- a/tdi/remote/MdsConnect.fun +++ b/tdi/remote/MdsConnect.fun @@ -13,6 +13,7 @@ call: _host = Host name eg elpp1.epfl.ch or elpp1.epfl.ch:9000 write(*,"Host taken from MDS_HOST ["//_host//"]"); } _status = TdiShrExt->rMdsConnect(ref(_host//char(0))); - if (present(_abort) && _status == 0) abort(); + _invalid_id = -1 + if (present(_abort) && _status == _invalid_id) abort(); return(_status); } From a0f06def721beba9f26f7a624ff9ebe639900a9c Mon Sep 17 00:00:00 2001 From: mwinkel-dev <122583770+mwinkel-dev@users.noreply.github.com> Date: Tue, 25 Mar 2025 10:03:19 -0600 Subject: [PATCH 3/3] Fix: correct typo in MdsConnect.fun --- tdi/remote/MdsConnect.fun | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tdi/remote/MdsConnect.fun b/tdi/remote/MdsConnect.fun index 1c17208cbd..7f1ef67bdb 100644 --- a/tdi/remote/MdsConnect.fun +++ b/tdi/remote/MdsConnect.fun @@ -13,7 +13,7 @@ call: _host = Host name eg elpp1.epfl.ch or elpp1.epfl.ch:9000 write(*,"Host taken from MDS_HOST ["//_host//"]"); } _status = TdiShrExt->rMdsConnect(ref(_host//char(0))); - _invalid_id = -1 + _invalid_id = -1; if (present(_abort) && _status == _invalid_id) abort(); return(_status); }