Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
strudel2_backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab Downtime Notice
Date: Monday, 14 April Time: 1:00 PM – 2:00 PM (AEST) Reason: System patching to version 17.9.6
Show more breadcrumbs
hpc-team
strudel2_backend
Commits
3b125ca5
Commit
3b125ca5
authored
4 years ago
by
Chris Hines
Browse files
Options
Downloads
Patches
Plain Diff
still trying to get the ctrl_socket right
parent
531a8b84
No related branches found
No related tags found
3 merge requests
!77
Revert "disable agressive kill and restart"
,
!45
Test
,
!44
Dev
Pipeline
#11977
passed
4 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tes/sshwrapper/__init__.py
+16
-1
16 additions, 1 deletion
tes/sshwrapper/__init__.py
with
16 additions
and
1 deletion
tes/sshwrapper/__init__.py
+
16
−
1
View file @
3b125ca5
...
@@ -105,8 +105,8 @@ class Ssh:
...
@@ -105,8 +105,8 @@ class Ssh:
import
stat
import
stat
import
logging
import
logging
logger
=
logging
.
getLogger
()
logger
=
logging
.
getLogger
()
ctrlsocket
=
"
/tmp/cm-{}-{}
"
.
format
(
user
,
host
)
sess
.
lock
.
acquire
()
sess
.
lock
.
acquire
()
ctrlsocket
=
"
/tmp/cm-{}-{}
"
.
format
(
user
,
host
)
try
:
try
:
mode
=
os
.
stat
(
ctrlsocket
).
st_mode
mode
=
os
.
stat
(
ctrlsocket
).
st_mode
# If the control process died (docker restarted, or otherwise exited) but the socket was not removed:
# If the control process died (docker restarted, or otherwise exited) but the socket was not removed:
...
@@ -148,6 +148,7 @@ class Ssh:
...
@@ -148,6 +148,7 @@ class Ssh:
'
-p
'
,
sshport
,
'
-N
'
,
'
-l
'
,
user
,
host
])
'
-p
'
,
sshport
,
'
-N
'
,
'
-l
'
,
user
,
host
])
env
=
os
.
environ
.
copy
()
env
=
os
.
environ
.
copy
()
if
sess
.
socket
is
None
:
if
sess
.
socket
is
None
:
sess
.
lock
.
release
()
raise
SshAgentException
(
"
No ssh-agent yet
"
)
raise
SshAgentException
(
"
No ssh-agent yet
"
)
env
[
'
SSH_AUTH_SOCK
'
]
=
sess
.
socket
env
[
'
SSH_AUTH_SOCK
'
]
=
sess
.
socket
logger
.
debug
(
"
creating master socket
"
)
logger
.
debug
(
"
creating master socket
"
)
...
@@ -161,6 +162,15 @@ class Ssh:
...
@@ -161,6 +162,15 @@ class Ssh:
#logger.debug('communicate on the control port complete')
#logger.debug('communicate on the control port complete')
logger
.
debug
(
"
spanwed ssh mux with pid {}
"
.
format
(
ctrl_p
.
pid
))
logger
.
debug
(
"
spanwed ssh mux with pid {}
"
.
format
(
ctrl_p
.
pid
))
#sess.pids.append(ctrl_p.pid)
#sess.pids.append(ctrl_p.pid)
if
ctrlsocket
in
sess
.
ctrl_processes
:
logger
.
error
(
'
existing control process!!!
'
)
old_ctrl_p
=
sess
.
ctrl_processes
[
ctrlsocket
]
old_ctrl_p
.
poll
()
if
old_ctrl_p
.
returncode
is
not
None
:
logger
.
error
(
'
old ctrl_p is still running?
'
)
old_ctrl_p
.
kill
()
(
stderr
,
stdout
)
=
old_ctrl_p
.
communicate
()
logger
.
error
(
'
{} {}
'
.
format
(
stderr
,
stdout
))
sess
.
ctrl_processes
[
ctrlsocket
]
=
ctrl_p
sess
.
ctrl_processes
[
ctrlsocket
]
=
ctrl_p
notstarted
=
True
notstarted
=
True
notdead
=
True
notdead
=
True
...
@@ -172,6 +182,7 @@ class Ssh:
...
@@ -172,6 +182,7 @@ class Ssh:
notdead
=
False
notdead
=
False
(
stdout
,
stderr
)
=
ctrl_p
.
communicate
()
(
stdout
,
stderr
)
=
ctrl_p
.
communicate
()
logger
.
error
(
'
ctrl_p died {} {} {}
'
.
format
(
ctrl_p
.
returncode
,
stdout
,
stderr
))
logger
.
error
(
'
ctrl_p died {} {} {}
'
.
format
(
ctrl_p
.
returncode
,
stdout
,
stderr
))
sess
.
lock
.
release
()
raise
SshCtrlException
(
stderr
.
decode
())
raise
SshCtrlException
(
stderr
.
decode
())
try
:
try
:
mode
=
os
.
stat
(
ctrlsocket
).
st_mode
mode
=
os
.
stat
(
ctrlsocket
).
st_mode
...
@@ -182,6 +193,10 @@ class Ssh:
...
@@ -182,6 +193,10 @@ class Ssh:
wait
=
wait
+
1
wait
=
wait
+
1
if
wait
>
60
:
if
wait
>
60
:
ctrl_p
.
kill
()
ctrl_p
.
kill
()
(
stdout
,
stderr
)
=
ctrl_p
.
communicate
()
logger
.
error
(
'
ctrl_p was killed due to timeout {} {} {}
'
.
format
(
ctrl_p
.
returncode
,
stdout
,
stderr
))
sess
.
lock
.
release
()
raise
SshCtrlException
(
stderr
.
decode
())
sess
.
lock
.
release
()
sess
.
lock
.
release
()
return
ctrlsocket
return
ctrlsocket
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment