Skip to content

Commit 00dbfca

Browse files
author
andy
committed
Merge origin/main
2 parents aa90c5a + f4862be commit 00dbfca

29 files changed

Lines changed: 1357 additions & 72 deletions

‎CMakeLists.txt‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,6 +1931,32 @@ if(PYTHON3_EXECUTABLE)
19311931
add_test(NAME transport_local_terminal COMMAND testLocalTerminal)
19321932
set_tests_properties(transport_local_terminal PROPERTIES TIMEOUT 60)
19331933

1934+
# Run Management's Tail (TailSource) on a local machine; the same program
1935+
# runs against the test sshd from tests/transport/sshd/tail_test.sh.
1936+
add_executable(testTail tests/transport/testTail.C)
1937+
target_compile_definitions(testTail PRIVATE
1938+
ECCE_SOURCE_DIR="${CMAKE_SOURCE_DIR}")
1939+
target_link_libraries(testTail PRIVATE
1940+
eccecomm eccercmd eccedsi eccedav eccecipc eccefaces eccexml
1941+
eccetdat ecceutil ${XercesC_LIBRARIES})
1942+
add_test(NAME transport_tail COMMAND testTail)
1943+
set_tests_properties(transport_tail PROPERTIES TIMEOUT 120)
1944+
1945+
# The Tail window itself on Xvfb, local machine (tail_window_test.sh).
1946+
add_executable(tailwindow tests/transport/tailwindow.C)
1947+
target_compile_definitions(tailwindow PRIVATE ${wxWidgets_DEFINITIONS})
1948+
target_include_directories(tailwindow PRIVATE ${wxWidgets_INCLUDE_DIRS}
1949+
${XercesC_INCLUDE_DIRS})
1950+
target_link_libraries(tailwindow PRIVATE
1951+
eccewxguicomm eccewxgui eccecomm eccercmd eccedsi eccedav eccecipc
1952+
eccefaces eccexml eccetdat ecceutil ${wxWidgets_LIBRARIES}
1953+
${XercesC_LIBRARIES})
1954+
add_test(NAME transport_tail_window
1955+
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/transport/tail_window_test.sh
1956+
$<TARGET_FILE:tailwindow> ${CMAKE_CURRENT_SOURCE_DIR})
1957+
set_tests_properties(transport_tail_window PROPERTIES TIMEOUT 120
1958+
SKIP_RETURN_CODE 77)
1959+
19341960
# OpenSshTransport against a stand-in ssh script and the real `ssh -G`:
19351961
# process handling, file copies, streams, messages, backend choice.
19361962
add_executable(testOpenSshTransport tests/transport/testOpenSshTransport.C)

‎docs/claude/services/index.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ what the deployment mode needs (GETTING_STARTED, "Deployment modes"):
4747
- [Waiting for login: a lost monitor parks the job, session start catches it up](waiting-for-login.md)
4848
- [Test suites get a per-run state directory, ports and X display](test-suites-isolate-per-run.md)
4949
- [Full builds and long suites go to radium/tellurium via tools/offload](long-suites-go-to-offload-hosts.md)
50+
- [A remote view rides ECCE's own login, not an ssh of its own (Tail)](remote-views-use-ecces-own-login.md)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
type: pitfall
3+
title: "A remote view must ride ECCE's own login, not start an ssh of its own"
4+
area: services
5+
section: "Pitfalls"
6+
paths: ["src/comm/commtools/TailSource.C", "src/wxgui/comm/WxTailWindow.C", "src/comm/commtools/EcceShell.C", "src/comm/rcommand/SshTransport.C", "src/apps/organizer/CalcMgr.C"]
7+
issues: [204]
8+
---
9+
**Anything that shows a remote file runs over the RCommand connection that
10+
logged in, never through a terminal's own `ssh`.** Run Mgmt > Tail used to
11+
log in through RCommand (AuthCache, then passdialog) only to check the file,
12+
then start `xterm -e ssh -t host 'tail -f ...'`: an OpenSSH client that
13+
knows nothing of the libssh session, so a password-only cluster asked twice
14+
and a two-factor one wanted a second code.
15+
16+
Tail now opens `WxTailWindow`, fed by `TailSource`: one `RCommand`, a file
17+
check, then `startStream(script, true)`, which on libssh is
18+
`SshTransport::openStreamOnLogin` -- an exec channel on the session that
19+
just authenticated (the ordinary `openStream`, used by the job monitor,
20+
opens a session of its own and logs in again). Until `closeStream()` that
21+
session belongs to the stream's pump thread, and `run()`/SFTP on it fail
22+
with "busy". On OpenSSH (a shared connection) and locally (DirectTransport)
23+
the plain stream already shares the login. The script ends `tail` when its
24+
stdin closes (`cat >/dev/null; kill`), so a closed window or a dropped link
25+
leaves nothing running on the login node.
26+
27+
The terminal route remains behind the `TailInTerminal` preference
28+
(EcceGlobal) or `ECCE_TAIL_TERMINAL=1`; it passes ECCE's ControlPath
29+
(`OpenSshTransport::controlArgs`) to the terminal's ssh, so a connection
30+
ECCE shares is reused, but over libssh it still logs in again.
31+
Tests: `transport_tail`, `transport_tail_window` (ctest),
32+
`tests/transport/sshd/tail_test.sh` (one login per Tail, counted).

‎help/src/first-calculation.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@ in the panel next to the tree.
170170
To read the files while the job runs, select the calculation and use the
171171
**Run Mgmt** menu:
172172

173-
- **Tail -f on Output File...** follows the output as it grows.
173+
- **Tail -f on Output File...** follows the output as it grows, in a
174+
window of its own over the login ECCE already has for the machine, so
175+
it does not ask for the password again. **Pause** holds the view while
176+
new lines keep arriving; **Resume** shows them.
174177
- **View Output File...** and **View Input file...** open the files.
175178
- **View Run Log...** shows ECCE's log of the job.
176179

‎help/src/register-machines.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,10 @@ Put a command on the **Job script** tab if every code needs it, for
310310
example `module load openmpi`. Put it on the **Codes** tab if only one
311311
code does, for example the environment of Gaussian 16.
312312

313+
Commands such as `module load` work in job scripts. Job scripts run under
314+
`sh`, where the module system is not set up on its own, so ECCE sets it up
315+
(Lmod or Environment Modules) before the first `module` or `ml` command.
316+
313317
## Advanced: edit file
314318

315319
On the **Job script** tab, **Advanced: edit file...** opens the machine's

‎include/comm/EcceShell.H‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class EcceShell
4646
string frontendMode; // "forward" (-J) or "nested"; see RCommand::frontEndMode
4747
string geometry; // xterm only, e.g. "80x40"
4848
string remoteCommand; // as built by remoteCommand()
49+
vector<string> sshOptions; // e.g. ECCE's ControlPath for the host
4950
};
5051
// The local argv (terminal, its options, ssh); false with error set.
5152
static bool terminalArgv(const SshTerminal& t, vector<string>& argv,

‎include/comm/OpenSshTransport.H‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ public:
112112
const std::string& err,
113113
bool sharedConnection = false);
114114

115+
// The Control* options ECCE adds for this host, so that another ssh (a
116+
// terminal) rides the connection already logged in to; empty when the
117+
// user's own configuration does the sharing or nothing is shared.
118+
std::vector<std::string> controlArgs() const;
119+
115120
private:
116121
OpenSshTransport(const OpenSshTransport&);
117122
OpenSshTransport& operator=(const OpenSshTransport&);

‎include/comm/RCommand.H‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ public:
8383
// "libssh" or "openssh" when an ssh transport serves this connection
8484
// (OpenSSH for hosts whose ssh config shares connections), else "".
8585
string sshBackend() const;
86+
// ssh options that let another OpenSSH client (a terminal) reuse this
87+
// connection's shared login; empty when there is none to add.
88+
vector<string> terminalSshOptions() const;
8689

8790
bool hop(const string& hopMachine, const string& locShell="bash",
8891
const string& userName="", const string& password="",
@@ -92,8 +95,11 @@ public:
9295
// The monitor stream. startStream() runs the command on pipes (over
9396
// ssh, on a session and thread of its own); streamFd()/streamWrite() then
9497
// address it, and \003 sent through exec() becomes SIGINT to its process
95-
// group. streamFd() is -1 when no stream is open.
96-
bool startStream(const string& command);
98+
// group. streamFd() is -1 when no stream is open. onThisLogin runs an
99+
// ssh stream on this connection's own login instead (no second password
100+
// or one-time code); the connection then runs nothing else until
101+
// stopStream().
102+
bool startStream(const string& command, bool onThisLogin=false);
97103
void stopStream(int graceMs=2000);
98104

99105
bool streamWrite(const string& command);

‎include/comm/RemoteTransport.H‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ public:
5151
// with the env set. Reading EOF means the script or the connection ended.
5252
virtual RemoteStream* openStream(const std::string& script, int& fd,
5353
std::string& error) = 0;
54+
// The same, on the login this connection already made, so that nothing
55+
// asks for credentials again. Until closeStream() the connection serves
56+
// only this stream. A transport whose streams already share its login
57+
// (the OpenSSH client on a shared connection) needs nothing more.
58+
virtual RemoteStream* openStreamOnLogin(const std::string& script, int& fd,
59+
std::string& error)
60+
{ return openStream(script, fd, error); }
5461
// Asks the script to stop, as ^C would.
5562
virtual void interruptStream(RemoteStream* s) = 0;
5663
// Sends EOF, gives the script graceMs to finish, then ends it and frees s.

‎include/comm/SshTransport.H‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ public:
105105
virtual RemoteStream* openStream(const std::string& script, int& fd,
106106
std::string& error);
107107
// SIGINT to the script's shell (the session has no tty for ^C).
108+
virtual RemoteStream* openStreamOnLogin(const std::string& script, int& fd,
109+
std::string& error);
108110
virtual void interruptStream(RemoteStream* s);
109111
// Sends EOF, gives the script graceMs to finish, closes everything and
110112
// joins the thread. Frees s.
@@ -155,6 +157,7 @@ private:
155157
bool p_nested, p_forwardWorked, p_authFailed;
156158
SshJump* p_link;
157159
ssh_session_struct* p_session;
160+
bool p_lent; // p_session belongs to an openStreamOnLogin() stream
158161
sftp_session_struct* p_sftp;
159162
};
160163

0 commit comments

Comments
 (0)