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
d7266c70
Commit
d7266c70
authored
9 years ago
by
Giorgos Korfiatis
Browse files
Options
Downloads
Patches
Plain Diff
merge cli into main agkyra script
parent
a0556599
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
agkyra/cli.py
+6
-1
6 additions, 1 deletion
agkyra/cli.py
agkyra/scripts/agkyra
+18
-4
18 additions, 4 deletions
agkyra/scripts/agkyra
agkyra/scripts/cli.py
+0
-47
0 additions, 47 deletions
agkyra/scripts/cli.py
with
24 additions
and
52 deletions
agkyra/cli.py
+
6
−
1
View file @
d7266c70
...
@@ -109,6 +109,11 @@ class AgkyraCLI(cmd.Cmd):
...
@@ -109,6 +109,11 @@ class AgkyraCLI(cmd.Cmd):
cnf_cmds
=
ConfigCommands
()
cnf_cmds
=
ConfigCommands
()
helper
=
protocol
.
SessionHelper
()
helper
=
protocol
.
SessionHelper
()
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
callback
=
kwargs
.
pop
(
'
callback
'
,
None
)
self
.
debug
=
kwargs
.
pop
(
'
debug
'
,
None
)
cmd
.
Cmd
.
__init__
(
self
,
*
args
,
**
kwargs
)
@property
@property
def
client
(
self
):
def
client
(
self
):
"""
Return the helper client instace or None
"""
"""
Return the helper client instace or None
"""
...
@@ -246,7 +251,7 @@ class AgkyraCLI(cmd.Cmd):
...
@@ -246,7 +251,7 @@ class AgkyraCLI(cmd.Cmd):
client
=
self
.
client
client
=
self
.
client
if
not
client
:
if
not
client
:
sys
.
stderr
.
write
(
'
No Agkyra daemons running, starting one
'
)
sys
.
stderr
.
write
(
'
No Agkyra daemons running, starting one
'
)
protocol
.
launch_server
()
protocol
.
launch_server
(
self
.
callback
,
self
.
debug
)
sys
.
stderr
.
write
(
'
...
'
)
sys
.
stderr
.
write
(
'
...
'
)
self
.
helper
.
wait_session_to_load
()
self
.
helper
.
wait_session_to_load
()
sys
.
stderr
.
write
(
'
OK
\n
'
)
sys
.
stderr
.
write
(
'
OK
\n
'
)
...
...
This diff is collapsed.
Click to expand it.
agkyra/scripts/agkyra
+
18
−
4
View file @
d7266c70
...
@@ -42,7 +42,7 @@ def set_debug(debug):
...
@@ -42,7 +42,7 @@ def set_debug(debug):
LOGGER
.
setLevel
(
level
)
LOGGER
.
setLevel
(
level
)
def
run_server
(
debug
):
def
run_server
(
debug
,
extras
=
None
):
set_debug
(
debug
)
set_debug
(
debug
)
from
agkyra.protocol
import
SessionHelper
from
agkyra.protocol
import
SessionHelper
LOGGER
.
debug
(
'
Start the session helper
'
)
LOGGER
.
debug
(
'
Start the session helper
'
)
...
@@ -56,28 +56,42 @@ def run_server(debug):
...
@@ -56,28 +56,42 @@ def run_server(debug):
LOGGER
.
debug
(
'
Session Helper is now down
'
)
LOGGER
.
debug
(
'
Session Helper is now down
'
)
def
run_gui
(
debug
):
def
run_gui
(
debug
,
extras
=
None
):
set_debug
(
debug
)
set_debug
(
debug
)
from
agkyra
import
gui
from
agkyra
import
gui
gui
.
run
(
callback
=
CALLBACK
,
debug
=
debug
)
gui
.
run
(
callback
=
CALLBACK
,
debug
=
debug
)
def
run_cli
(
debug
,
extras
=
None
):
set_debug
(
debug
)
from
agkyra.cli
import
AgkyraCLI
agkcli
=
AgkyraCLI
(
callback
=
CALLBACK
,
debug
=
debug
)
agkcli
.
onecmd
(
'
'
.
join
(
extras
or
[
'
help
'
,
]))
DISPATCH
=
{
DISPATCH
=
{
'
server
'
:
run_server
,
'
server
'
:
run_server
,
'
gui
'
:
run_gui
,
'
gui
'
:
run_gui
,
'
cli
'
:
run_cli
,
}
}
parser
=
argparse
.
ArgumentParser
(
description
=
'
Agkyra syncer launcher
'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'
Agkyra syncer launcher
'
)
parser
.
add_argument
(
'
--debug
'
,
'
-d
'
,
action
=
'
store_true
'
,
parser
.
add_argument
(
'
--debug
'
,
'
-d
'
,
action
=
'
store_true
'
,
help
=
"
set logging level to
'
debug
'"
)
help
=
"
set logging level to
'
debug
'"
)
parser
.
add_argument
(
'
component
'
,
nargs
=
"
?
"
,
default
=
"
gui
"
,
parser
.
add_argument
(
'
component
'
,
nargs
=
"
?
"
,
default
=
"
gui
"
,
help
=
"
run
'
server
'
or
'
gui
'
(default)
"
)
help
=
"
run
'
server
'
,
'
cli
'
, or
'
gui
'
(default)
"
)
parser
.
add_argument
(
'
command
'
,
nargs
=
"
*
"
,
help
=
"
command in case of cli
"
)
def
main
():
def
main
():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
debug
=
args
.
debug
debug
=
args
.
debug
set_debug
(
debug
)
set_debug
(
debug
)
component
=
args
.
component
component
=
args
.
component
DISPATCH
[
component
](
debug
)
action
=
DISPATCH
.
get
(
component
)
if
action
is
None
:
print
"
No such component
'
%s
'
.
"
%
component
return
action
(
debug
,
extras
=
args
.
command
)
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
main
()
main
()
This diff is collapsed.
Click to expand it.
agkyra/scripts/cli.py
deleted
100755 → 0
+
0
−
47
View file @
a0556599
#!/usr/bin/env python
# Copyright (C) 2015 GRNET S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
os
import
sys
PATH
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
LIBPATH
=
os
.
path
.
join
(
PATH
,
"
lib
"
)
sys
.
path
.
insert
(
0
,
LIBPATH
)
from
agkyra
import
config
AGKYRA_DIR
=
config
.
AGKYRA_DIR
import
logging
LOGFILE
=
os
.
path
.
join
(
AGKYRA_DIR
,
'
agkyra.log
'
)
LOGGER
=
logging
.
getLogger
(
'
agkyra
'
)
HANDLER
=
logging
.
FileHandler
(
LOGFILE
)
FORMATTER
=
logging
.
Formatter
(
"
%(name)s:%(lineno)s %(levelname)s:%(asctime)s:%(message)s
"
)
HANDLER
.
setFormatter
(
FORMATTER
)
LOGGER
.
addHandler
(
HANDLER
)
LOGGER
.
setLevel
(
logging
.
INFO
)
def
main
():
from
agkyra.cli
import
AgkyraCLI
from
sys
import
argv
AgkyraCLI
().
onecmd
(
'
'
.
join
(
argv
[
1
:]
or
[
'
help
'
,
]))
if
__name__
==
"
__main__
"
:
main
()
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