Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Thompson
slapos.toolbox
Commits
0f7a4d3e
Commit
0f7a4d3e
authored
Mar 28, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Webrunner Support more instances at the same time
parent
06350aed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
34 deletions
+105
-34
slapos/runner/static/js/scripts/inspectInstance.js
slapos/runner/static/js/scripts/inspectInstance.js
+36
-1
slapos/runner/templates/instanceInspect.html
slapos/runner/templates/instanceInspect.html
+57
-29
slapos/runner/utils.py
slapos/runner/utils.py
+10
-2
slapos/runner/views.py
slapos/runner/views.py
+2
-2
No files found.
slapos/runner/static/js/scripts/inspectInstance.js
View file @
0f7a4d3e
$
(
document
).
ready
(
function
()
{
var
editor
;
setupFileTree
();
$
(
$
(
"
#slappart li
"
)[
0
]).
find
(
"
input:radio
"
).
attr
(
'
checked
'
,
true
);
$
(
"
.menu-box-right>div
"
).
css
(
'
min-height
'
,
$
(
"
#slappart li
"
).
length
*
26
+
20
+
"
px
"
);
configRadio
();
var
lastli
=
null
;
var
partitionAmount
=
$
(
"
imput#partitionAmount
"
).
val
();
$
(
"
#slappart li
"
).
each
(
function
(){
lastli
=
$
(
this
);
$
(
this
).
find
(
"
input:radio
"
).
change
(
function
(){
configRadio
();
});
});
lastli
.
css
(
"
border-bottom
"
,
"
none
"
);
function
setupFileTree
(){
var
root
=
$
(
"
input#root
"
).
val
();
...
...
@@ -79,7 +91,22 @@ $(document).ready( function() {
}
});
}
function
configRadio
(){
$
(
"
#slappart li
"
).
each
(
function
()
{
var
$radio
=
$
(
this
).
find
(
"
input:radio
"
);
var
boxselector
=
"
#box
"
+
$radio
.
attr
(
'
id
'
);
if
(
$
(
this
).
hasClass
(
'
checked
'
)){
$
(
this
).
removeClass
(
'
checked
'
);
$
(
boxselector
).
slideUp
(
"
normal
"
);
}
if
(
$radio
.
is
(
'
:checked
'
)){
$
(
this
).
addClass
(
'
checked
'
);
//change content here
$
(
boxselector
).
slideDown
(
"
normal
"
);
}
});
}
function
setupEditor
(){
editor
=
ace
.
edit
(
"
editor
"
);
editor
.
setTheme
(
"
ace/theme/crimson_editor
"
);
...
...
@@ -91,4 +118,12 @@ $(document).ready( function() {
editor
.
renderer
.
setHScrollBarAlwaysVisible
(
false
);
editor
.
setReadOnly
(
true
);
}
function
setupSlappart
(){
for
(
var
i
=
0
;
i
<
partitionAmount
;
i
++
){
var
elt
=
$
(
"
#slappart
"
+
i
+
"
Parameter
"
);
if
(
elt
!=
undefined
)
elt
.
click
(
function
(){
alert
(
elt
.
attr
(
'
id
'
));
});
}
}
});
\ No newline at end of file
slapos/runner/templates/instanceInspect.html
View file @
0f7a4d3e
...
...
@@ -14,58 +14,86 @@
{% endblock %}
{% block body %}
<input
type=
'hidden'
name=
'root'
id=
'root'
value=
'{%if file_path != "" %}{{file_path}}{%endif%}'
/>
<input
type=
"hidden"
name=
"partition_amount"
id=
"partitionAmount"
value=
"{{ partition_amount }}"
/>
<h2>
Instance inspection
</h2><br/>
<div
id=
"tabContaier"
>
<ul>
<li><a
class=
"active"
href=
"#tab1"
>
Parameters
</a></li>
<li><a
href=
"#tab2"
>
Slapgrid Supervisor
</a></li>
<li><a
href=
"#tab3"
>
SLAP response
</a></li>
<li><a
href=
"#tab4"
>
Partitions Content
</a></li>
<li><a
href=
"#tab1"
class=
"active"
>
Slapgrid Supervisor
</a></li>
<li><a
href=
"#tab2"
>
SLAP Response
&
Parameters
</a></li>
<li><a
href=
"#tab3"
>
Partitions Content
</a></li>
</ul>
<!-- //Tab buttons -->
<div
class=
"tabDetails"
>
<div
id=
"tab1"
class=
"tabContents"
>
<p>
Add your instance parameters here and click on the update button
</p>
<textarea
class=
"parameter"
id=
"parameter"
></textarea>
<input
type=
"submit"
name=
"update"
id =
"update"
value=
"Update"
class=
"button"
/>
</div>
<!-- end tab1 -->
<div
id=
"tab2"
class=
"tabContents"
>
<div
id=
"tab1"
class=
"tabContents"
>
<p>
This tab show all process generated by slapgrid for your application. You can click on the process name to display log.
</p>
{% if supervisor
!= []
%}
{% if supervisor %}
<table
cellpadding=
"0"
cellspacing=
"0"
width=
"100%"
>
<tr>
<th>
Partition and Process name
</th><th>
Status
</th><th>
Process PID
</th><th>
UpTime
</th><th></th>
</tr>
{% for item in supervisor %}
<tr>
<td><b><a
href=
"{{ url_for('tailProcess', process=item[0]) }}"
>
{{ item[0]}}
</a></b></td>
<td
class=
'first'
><b><a
href=
"{{ url_for('tailProcess', process=item[0]) }}"
>
{{ item[0]}}
</a></b></td>
<td
align=
"center"
><a
href=
"{{ url_for('startStopProccess', process=item[0], action=item[1]) }}"
>
{{ item[1]}}
</a></td>
<td
align=
"center"
>
{{ item[3]}}
</td><td>
{{ item[5]}}
</td>
<td
align=
"center"
><a
href=
"{{ url_for('startStopProccess', process=item[0], action='RESTART') }}"
>
Restart
</a></td>
</tr>
{% endfor %}
</table>
</table><br/>
<a
href=
"{{ url_for('stopAllPartition') }}"
class=
"lshare simple"
>
Stop all process
</a>
{% else %}
<h2>
No process to display, please run your instance
</h2>
{%endif%}
</div>
<!-- end tab1 -->
<div
id=
"tab2"
class=
"tabContents"
>
{% if slap_status %}
<p>
Uses parameters below to run your application
</p>
<div
class=
"menu-box-right"
style=
"width: 597px;"
>
<div
style=
"background:#fff; padding:10px;"
>
{% for item in slap_status %}
<div
id=
"box{{item[0]}}"
style=
"display:none;"
>
{% if item[1] %}
<!--<h2><span style="float:left; margin-left:10px;" id="{{item[0]}}title">Slap Response for {{item[0]}}</span>
<a href="#" id="{{item[0]}}Parameter" rel="{{item[0]}}" class="lshare simple" style="float:right">SLAP Parameters</a>
</h2>-->
<h2>
Slap Response for {{item[0]}}
</h2>
<div
class=
"clear"
></div><br/>
<div
id=
"bcontent{{item[0]}}"
>
<table
cellpadding=
"0"
cellspacing=
"0"
width=
"100%"
>
<tr>
<th>
Parameter Name
</th><th>
Parameter Value
</th>
</tr>
{% for k in item[1] %}
<tr>
<td
class=
"propertie first"
>
{{k}}
</td><td
align=
'left'
>
{{item[1][k]}}
</td>
</tr>
{% endfor %}
</table>
</div>
{% else %}
<h2>
Empty Partition
</h2></br>
<center><img
alt=
""
src=
"{{ url_for('static', filename='images/empty.png') }}"
/></center>
<br/><h2>
Partition {{item[0]}} is still empty
</h2>
{%endif%}
</div>
{% endfor %}
</div>
</div>
<div
class=
"menu-box-left"
style=
"width: 110px;"
>
<ul
id=
"slappart"
>
{% for item in slap_status %}
<li><input
type=
"radio"
name=
"slapresponse"
id=
"{{item[0]}}"
value=
"{{item[0]}}"
/>
<label
for=
"{{item[0]}}"
{%
if
item
[
1
]
%}
style=
"font-weight:bold"
{%
endif
%}
>
{{item[0]}}
</label></li>
{% endfor %}
</ul>
</div>
<div
class=
"clear"
></div><br/>
{% else %}
<h2>
No response. Please run Software Instance!
</h2>
{%endif%}
</div>
<!-- end tab2 -->
<div
id=
"tab3"
class=
"tabContents"
>
<p>
Uses parameters below to run your application
</p>
<table
cellpadding=
"0"
cellspacing=
"0"
width=
"100%"
>
{% for item in slap_status %}
<tr>
<th
align=
'left'
colspan=
'2'
>
Computer Partition {{ item[0]}}
</th>
</tr>
{% for k in item[1] %}
<tr>
<td>
{{k}}
</td><td
align=
'left'
>
{{item[1][k]}}
</td>
</tr>
{% endfor %}
{% endfor %}
</table>
</div>
<!-- end tab3 -->
<div
id=
"tab4"
class=
"tabContents"
>
<div
id=
"fileTree"
class=
"file_tree_tabs"
></div>
</div>
<!-- end tab
4
-->
</div>
<!-- end tab
3
-->
</div>
</div>
<!-- This contains the hidden content for inline calls -->
...
...
slapos/runner/utils.py
View file @
0f7a4d3e
...
...
@@ -86,9 +86,11 @@ def updateProxy(config):
else
:
partition_parameter_kw
=
None
computer
.
updateConfiguration
(
xml_marshaller
.
dumps
(
slap_config
))
slap
.
registerOpenOrder
().
request
(
profile
,
partition_reference
=
partition_reference
,
s
r_request
=
s
lap
.
registerOpenOrder
().
request
(
profile
,
partition_reference
=
partition_reference
,
partition_parameter_kw
=
partition_parameter_kw
,
software_type
=
None
,
filter_kw
=
None
,
state
=
None
,
shared
=
False
)
#open(param_path, 'w').write(xml_marshaller.dumps(sr_request.
# getInstanceParameterDict()))
return
True
def
readPid
(
file
):
...
...
@@ -257,9 +259,15 @@ def getSlapStatus(config):
try
:
for
partition
in
computer
.
getComputerPartitionList
():
# Note: Internal use of API, as there is no reflexion interface in SLAP
partition_list
.
append
((
partition
.
getId
(),
partition
.
_connection_dict
.
copy
()))
partition_list
.
append
((
partition
.
getId
(),
partition
.
_connection_dict
.
copy
(),
partition
.
_parameter_dict
.
copy
()))
except
Exception
:
pass
if
partition_list
:
for
i
in
xrange
(
0
,
int
(
config
[
'partition_amount'
])):
slappart_id
=
'%s%s'
%
(
"slappart"
,
i
)
if
not
[
x
[
0
]
for
x
in
partition_list
if
slappart_id
==
x
[
0
]]:
partition_list
.
append
((
slappart_id
,
[]))
return
partition_list
def
runBuildoutAnnotate
(
config
):
...
...
slapos/runner/views.py
View file @
0f7a4d3e
...
...
@@ -88,10 +88,10 @@ def inspectInstance():
file_content
=
'instance_root'
result
=
getSvcStatus
(
app
.
config
)
if
len
(
result
)
==
0
:
result
=
[]
result
=
[]
return
render_template
(
'instanceInspect.html'
,
file_path
=
file_content
,
supervisor
=
result
,
slap_status
=
getSlapStatus
(
app
.
config
),
supervisore
=
result
)
supervisore
=
result
,
partition_amount
=
app
.
config
[
'partition_amount'
]
)
@
app
.
route
(
'/removeInstance'
)
def
removeInstance
():
...
...
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