Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
12d447e5
Commit
12d447e5
authored
Oct 03, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor planner: separate functions
parent
8eb5c246
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
285 additions
and
19 deletions
+285
-19
workspace.xml
drip_planner2/.idea/workspace.xml
+22
-9
basic_planner.py
drip_planner2/src/planner/basic_planner.py
+1
-1
planner.py
drip_planner2/src/planner/planner.py
+240
-0
spec_service.py
drip_planner2/src/planner/spec_service.py
+8
-0
rpc_server.py
drip_planner2/src/rpc_server.py
+14
-9
No files found.
drip_planner2/.idea/workspace.xml
View file @
12d447e5
...
@@ -2,16 +2,17 @@
...
@@ -2,16 +2,17 @@
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"462ede19-adfe-472b-975e-fefefa973fe0"
name=
"Default Changelist"
comment=
"slolved cap error"
>
<list
default=
"true"
id=
"462ede19-adfe-472b-975e-fefefa973fe0"
name=
"Default Changelist"
comment=
"slolved cap error"
>
<change
beforePath=
"$PROJECT_DIR$/../build.sh"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../build.sh
"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/planner/planner.py
"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../drip-api/hs_err_pid26067.log"
before
Dir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/planner/spec_service.py"
after
Dir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/planner/basic_planner.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/planner/basic_planner.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/rpc_server.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/rpc_server.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/easy-install.pth"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/easy-install.pth"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/prettytable.py"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/prettytable.py"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/pyparsing.py"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/pyparsing.py"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/setuptools-40.8.0-py3.6.egg"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/setuptools-40.8.0-py3.6.egg"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/setuptools.pth"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/setuptools.pth"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/six.py"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/venv/lib/python3.6/site-packages/six.py"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../etc.tar.gz"
beforeDir=
"false"
/>
</list>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
...
@@ -19,6 +20,13 @@
...
@@ -19,6 +20,13 @@
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
<option
name=
"LAST_RESOLUTION"
value=
"IGNORE"
/>
<option
name=
"LAST_RESOLUTION"
value=
"IGNORE"
/>
</component>
</component>
<component
name=
"FileTemplateManagerImpl"
>
<option
name=
"RECENT_TEMPLATES"
>
<list>
<option
value=
"Python Script"
/>
</list>
</option>
</component>
<component
name=
"Git.Settings"
>
<component
name=
"Git.Settings"
>
<option
name=
"RECENT_GIT_ROOT_PATH"
value=
"$PROJECT_DIR$/.."
/>
<option
name=
"RECENT_GIT_ROOT_PATH"
value=
"$PROJECT_DIR$/.."
/>
</component>
</component>
...
@@ -35,9 +43,14 @@
...
@@ -35,9 +43,14 @@
<property
name=
"SHARE_PROJECT_CONFIGURATION_FILES"
value=
"true"
/>
<property
name=
"SHARE_PROJECT_CONFIGURATION_FILES"
value=
"true"
/>
<property
name=
"TODO_SCOPE"
value=
"All Places"
/>
<property
name=
"TODO_SCOPE"
value=
"All Places"
/>
<property
name=
"full.screen.before.presentation.mode"
value=
"false"
/>
<property
name=
"full.screen.before.presentation.mode"
value=
"false"
/>
<property
name=
"last_opened_file_path"
value=
"$PROJECT_DIR$/
../drip-provisio
ner"
/>
<property
name=
"last_opened_file_path"
value=
"$PROJECT_DIR$/
src/plan
ner"
/>
<property
name=
"settings.editor.selected.configurable"
value=
"com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable"
/>
<property
name=
"settings.editor.selected.configurable"
value=
"com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable"
/>
</component>
</component>
<component
name=
"RecentsManager"
>
<key
name=
"CopyFile.RECENT_KEYS"
>
<recent
name=
"$PROJECT_DIR$/src/planner"
/>
</key>
</component>
<component
name=
"RunDashboard"
>
<component
name=
"RunDashboard"
>
<option
name=
"ruleStates"
>
<option
name=
"ruleStates"
>
<list>
<list>
...
@@ -64,7 +77,7 @@
...
@@ -64,7 +77,7 @@
<option
name=
"ADD_CONTENT_ROOTS"
value=
"true"
/>
<option
name=
"ADD_CONTENT_ROOTS"
value=
"true"
/>
<option
name=
"ADD_SOURCE_ROOTS"
value=
"true"
/>
<option
name=
"ADD_SOURCE_ROOTS"
value=
"true"
/>
<option
name=
"SCRIPT_NAME"
value=
"$PROJECT_DIR$/src/planner/basic_planner.py"
/>
<option
name=
"SCRIPT_NAME"
value=
"$PROJECT_DIR$/src/planner/basic_planner.py"
/>
<option
name=
"PARAMETERS"
value=
""
/>
<option
name=
"PARAMETERS"
value=
"
test_local
"
/>
<option
name=
"SHOW_COMMAND_LINE"
value=
"false"
/>
<option
name=
"SHOW_COMMAND_LINE"
value=
"false"
/>
<option
name=
"EMULATE_TERMINAL"
value=
"false"
/>
<option
name=
"EMULATE_TERMINAL"
value=
"false"
/>
<option
name=
"MODULE_MODE"
value=
"false"
/>
<option
name=
"MODULE_MODE"
value=
"false"
/>
...
@@ -85,7 +98,7 @@
...
@@ -85,7 +98,7 @@
<option
name=
"ADD_CONTENT_ROOTS"
value=
"true"
/>
<option
name=
"ADD_CONTENT_ROOTS"
value=
"true"
/>
<option
name=
"ADD_SOURCE_ROOTS"
value=
"true"
/>
<option
name=
"ADD_SOURCE_ROOTS"
value=
"true"
/>
<option
name=
"SCRIPT_NAME"
value=
"$PROJECT_DIR$/src/rpc_server.py"
/>
<option
name=
"SCRIPT_NAME"
value=
"$PROJECT_DIR$/src/rpc_server.py"
/>
<option
name=
"PARAMETERS"
value=
"
localhost planner_queue
"
/>
<option
name=
"PARAMETERS"
value=
"
test_local
"
/>
<option
name=
"SHOW_COMMAND_LINE"
value=
"false"
/>
<option
name=
"SHOW_COMMAND_LINE"
value=
"false"
/>
<option
name=
"EMULATE_TERMINAL"
value=
"false"
/>
<option
name=
"EMULATE_TERMINAL"
value=
"false"
/>
<option
name=
"MODULE_MODE"
value=
"false"
/>
<option
name=
"MODULE_MODE"
value=
"false"
/>
...
@@ -180,9 +193,9 @@
...
@@ -180,9 +193,9 @@
<option
name=
"timeStamp"
value=
"1"
/>
<option
name=
"timeStamp"
value=
"1"
/>
</line-breakpoint>
</line-breakpoint>
<line-breakpoint
enabled=
"true"
suspend=
"THREAD"
type=
"python-line"
>
<line-breakpoint
enabled=
"true"
suspend=
"THREAD"
type=
"python-line"
>
<url>
file://$PROJECT_DIR$/src/planner/
basic_
planner.py
</url>
<url>
file://$PROJECT_DIR$/src/planner/planner.py
</url>
<line>
152
</line>
<line>
44
</line>
<option
name=
"timeStamp"
value=
"
4
"
/>
<option
name=
"timeStamp"
value=
"
5
"
/>
</line-breakpoint>
</line-breakpoint>
</breakpoints>
</breakpoints>
<default-breakpoints>
<default-breakpoints>
...
...
drip_planner2/src/planner/basic_planner.py
View file @
12d447e5
...
@@ -13,9 +13,9 @@ import sys
...
@@ -13,9 +13,9 @@ import sys
import
pdb
import
pdb
import
names
import
names
import
yaml
import
yaml
from
utils.TOSCA_parser
import
*
import
logging
import
logging
# from src.utils.TOSCA_parser import TOSCAParser
# from src.utils.TOSCA_parser import TOSCAParser
...
...
drip_planner2/src/planner/planner.py
0 → 100644
View file @
12d447e5
This diff is collapsed.
Click to expand it.
drip_planner2/src/planner/spec_service.py
0 → 100644
View file @
12d447e5
class
SpecService
:
def
__init__
(
self
,
props
):
self
.
properties
=
props
def
get_vm_username
(
self
):
return
"vm_user"
\ No newline at end of file
drip_planner2/src/rpc_server.py
View file @
12d447e5
...
@@ -8,6 +8,7 @@ import os
...
@@ -8,6 +8,7 @@ import os
import
os.path
import
os.path
from
builtins
import
print
from
builtins
import
print
from
planner.basic_planner
import
*
from
planner.basic_planner
import
*
from
planner.planner
import
*
import
pika
import
pika
import
sys
import
sys
import
tempfile
import
tempfile
...
@@ -16,13 +17,13 @@ import logging
...
@@ -16,13 +17,13 @@ import logging
import
base64
import
base64
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
if
not
getattr
(
logger
,
'handler_set'
,
None
):
#
if not getattr(logger, 'handler_set', None):
logger
.
setLevel
(
logging
.
INFO
)
#
logger.setLevel(logging.INFO)
h
=
logging
.
StreamHandler
()
#
h = logging.StreamHandler()
formatter
=
logging
.
Formatter
(
'
%(asctime)
s -
%(name)
s -
%(levelname)
s -
%(message)
s'
)
#
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
h
.
setFormatter
(
formatter
)
#
h.setFormatter(formatter)
logger
.
addHandler
(
h
)
#
logger.addHandler(h)
logger
.
handler_set
=
True
#
logger.handler_set = True
def
init_chanel
(
args
):
def
init_chanel
(
args
):
...
@@ -124,8 +125,12 @@ if __name__ == "__main__":
...
@@ -124,8 +125,12 @@ if __name__ == "__main__":
# servicetemplate_id = "wordpress_w1-wip1"
# servicetemplate_id = "wordpress_w1-wip1"
# planner = WineryPlanner(tosca_reposetory_api_base_url,namespace,servicetemplate_id)
# planner = WineryPlanner(tosca_reposetory_api_base_url,namespace,servicetemplate_id)
tosca_file_path
=
"../../TOSCA/application_example.yaml"
tosca_file_path
=
"../../TOSCA/application_example.yaml"
planner
=
BasicPlanner
(
tosca_file_path
)
# planner = BasicPlanner(tosca_file_path)
print
(
planner
.
get_plan
())
planner
=
Planner
(
tosca_file_path
)
planner
.
resolve_requirements
()
planner
.
set_infrastructure_specifications
()
template
=
planner
.
get_tosca_template
()
# logger.info("template ----: \n" + template)
else
:
else
:
logger
.
info
(
"Input args: "
+
sys
.
argv
[
0
]
+
' '
+
sys
.
argv
[
1
]
+
' '
+
sys
.
argv
[
2
])
logger
.
info
(
"Input args: "
+
sys
.
argv
[
0
]
+
' '
+
sys
.
argv
[
1
]
+
' '
+
sys
.
argv
[
2
])
channel
=
init_chanel
(
sys
.
argv
)
channel
=
init_chanel
(
sys
.
argv
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment