Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
agkyra
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Show more breadcrumbs
itminedu
agkyra
Commits
666252f8
Commit
666252f8
authored
9 years ago
by
Giorgos Korfiatis
Browse files
Options
Downloads
Patches
Plain Diff
Handle connection refused errors at start up
parent
6a5aad77
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
agkyra/cli.py
+34
-5
34 additions, 5 deletions
agkyra/cli.py
agkyra/gui.py
+5
-1
5 additions, 1 deletion
agkyra/gui.py
with
39 additions
and
6 deletions
agkyra/cli.py
+
34
−
5
View file @
666252f8
...
@@ -18,6 +18,8 @@ import os
...
@@ -18,6 +18,8 @@ import os
import
sys
import
sys
import
logging
import
logging
import
argparse
import
argparse
import
errno
import
socket
from
agkyra
import
protocol
,
protocol_client
,
gui
,
config
from
agkyra
import
protocol
,
protocol_client
,
gui
,
config
...
@@ -229,13 +231,29 @@ class AgkyraCLI(cmd.Cmd):
...
@@ -229,13 +231,29 @@ class AgkyraCLI(cmd.Cmd):
def
client
(
self
):
def
client
(
self
):
"""
Return the helper client instace or None
"""
"""
Return the helper client instace or None
"""
self
.
_client
=
getattr
(
self
,
'
_client
'
,
None
)
self
.
_client
=
getattr
(
self
,
'
_client
'
,
None
)
if
not
self
.
_client
:
if
self
.
_client
is
None
:
session
=
self
.
helper
.
load_active_session
()
self
.
_client
=
self
.
try_make_client
()
if
session
:
self
.
_client
=
protocol_client
.
UIClient
(
session
)
self
.
_client
.
connect
()
return
self
.
_client
return
self
.
_client
def
try_make_client
(
self
):
session
=
self
.
helper
.
load_active_session
()
if
session
:
client
=
protocol_client
.
UIClient
(
session
)
try
:
client
.
connect
()
return
client
except
socket
.
error
as
e
:
if
e
.
errno
==
errno
.
ECONNREFUSED
:
sys
.
stderr
.
write
(
"
It seems that a previous Agkyra execution hasn
'
t
"
"
exited properly.
\n
Please, try again after a few
"
"
seconds.
\n
"
)
exit
(
1
)
else
:
raise
else
:
return
None
def
do_help
(
self
,
line
):
def
do_help
(
self
,
line
):
"""
Help on agkyra GUI and CLI
"""
Help on agkyra GUI and CLI
agkyra Run agkyra with GUI (equivalent to
"
agkyra gui
"
)
agkyra Run agkyra with GUI (equivalent to
"
agkyra gui
"
)
...
@@ -484,6 +502,17 @@ class AgkyraCLI(cmd.Cmd):
...
@@ -484,6 +502,17 @@ class AgkyraCLI(cmd.Cmd):
sys
.
stderr
.
write
(
'
GUI interrupted by user, exiting
\n
'
)
sys
.
stderr
.
write
(
'
GUI interrupted by user, exiting
\n
'
)
sys
.
stderr
.
flush
()
sys
.
stderr
.
flush
()
new_gui
.
clean_exit
()
new_gui
.
clean_exit
()
except
socket
.
error
as
e
:
if
e
.
errno
==
errno
.
ECONNREFUSED
:
sys
.
stderr
.
write
(
"
It seems that a previous Agkyra execution hasn
'
t
"
"
exited properly.
\n
Please, try again after a few
"
"
seconds.
\n
"
)
new_gui
.
clean_exit
()
exit
(
1
)
else
:
raise
LOGGER
.
info
(
'
GUI is shutdown
'
)
LOGGER
.
info
(
'
GUI is shutdown
'
)
if
self
.
client
:
if
self
.
client
:
self
.
_shutdown
(
''
)
self
.
_shutdown
(
''
)
...
...
This diff is collapsed.
Click to expand it.
agkyra/gui.py
+
5
−
1
View file @
666252f8
...
@@ -88,7 +88,11 @@ class GUI(WebSocketBaseClient):
...
@@ -88,7 +88,11 @@ class GUI(WebSocketBaseClient):
LOG
.
debug
(
'
Removed session file %s
'
%
self
.
session_file
)
LOG
.
debug
(
'
Removed session file %s
'
%
self
.
session_file
)
except
Exception
as
e
:
except
Exception
as
e
:
LOG
.
warning
(
'
While cleaning GUI: %s
'
%
e
)
LOG
.
warning
(
'
While cleaning GUI: %s
'
%
e
)
self
.
close
()
try
:
self
.
close
()
LOG
.
debug
(
'
Closed GUI connection
'
)
except
Exception
as
e
:
LOG
.
warning
(
'
While cleaning GUI: %s
'
%
e
)
def
handshake_ok
(
self
):
def
handshake_ok
(
self
):
"""
If handshake OK is, SessionHelper UP goes, so GUI launched can be
"""
"""
If handshake OK is, SessionHelper UP goes, so GUI launched can be
"""
...
...
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