Skip to content

Commit

Permalink
spark cluster and host work
Browse files Browse the repository at this point in the history
  • Loading branch information
ghukill committed May 21, 2019
1 parent cfd3bf5 commit 41fc17e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Update XML2kvp to limit values at 32k characters [#403](https://github.com/WSULib/combine/issues/403)
- Converting tabs to spaces per PEP 8 recs
- Updating [DPLA Ingestion3](https://github.com/dpla/ingestion3)
- For Ansible build, setting default Spark application to `local[*]` as opposed to local, standalone cluster [#29](https://github.com/WSULib/combine-playbook/issues/29)


## `v0.8`
Expand Down
13 changes: 13 additions & 0 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,19 @@ def livy_session_ready(response):
return new_ls


def session_port(self):

'''
Method to return port from sparkUiURL
'''

spark_url = getattr(self, 'sparkUiUrl', None)
if spark_url is not None:
return spark_url.split(':')[-1]
else:
return False



class Organization(models.Model):

Expand Down
16 changes: 7 additions & 9 deletions core/templates/core/system.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="col-md-12">
<h2>Livy/Spark Session</h2>
<p>Apache Livy is what faciliates communciation between the Combine Django application, and a Spark context for processing Jobs. <a target="_blank" href="http://combine.readthedocs.io/en/master/spark_and_livy.html">Read more about Spark and Livy in the Combine documentation</a>.</p>
<p>Apache Livy is what faciliates communciation between the Combine Django application, and a Spark context for processing Jobs. <a target="_blank" href="http://combine.readthedocs.io/en/master/spark_and_livy.html">Read more about Spark and Livy in the Combine documentation</a>.</p>
</div>

<div class="col-md-12">
Expand All @@ -20,11 +20,10 @@ <h2>Livy/Spark Session</h2>
<th>Active</th>
<th>Name</th>
<th>Livy Session ID</th>
<th>Livy Session</th>
<th>Livy Session</th>
<th>Status</th>
<th>Timestamp</th>
<th>Spark Application</th>
<th>Spark Cluster</th>
<th>Actions</th>
</tr>
{% for livy_session in livy_sessions %}
Expand All @@ -36,8 +35,7 @@ <h2>Livy/Spark Session</h2>
<td><a href="http://{{ APP_HOST }}:8998/ui/session/{{ livy_session.session_id }}">http://{{ APP_HOST }}:8998/ui/session/{{ livy_session.session_id }}</a></td>
<td class="{% if livy_session.status == 'idle' %}bg_light_green{% elif livy_session.status == 'starting' or livy_session.status == 'busy' %}bg_light_yellow{% else %}bg_light_red{% endif %}">{{ livy_session.status }}</td>
<td>{{ livy_session.timestamp }}</td>
<td><a href="http://{{livy_session.sparkUiUrl}}">http://{{livy_session.sparkUiUrl}}</a></td>
<td><a href="http://{{ APP_HOST }}:8080">http://{{ APP_HOST }}:8080</a></td>
<td><a href="http://{{ APP_HOST }}:{{livy_session.session_port}}">http://{{ APP_HOST }}:{{livy_session.session_port}}</a></td>
<td><a href="{% url 'livy_session_stop' session_id=livy_session.id %}" onclick="return confirm('Are you sure you want to stop/remove this Livy session? If so, it will have to be manually restarted for any jobs to run!');"><button type="button" class="btn btn-danger btn-sm">{% if livy_session.status == 'idle' or livy_session.status == 'busy' or livy_session.status == 'starting' %}Stop <i class="la la-close"></i>{% else %}Remove <i class="la la-close"></i>{% endif %}</button></a> <a href="{% url 'livy_session_start' %}?restart=true" onclick="return confirm('Are you sure you want to restart this Livy session? If so, this may take a few moments to restart...');"><button type="button" class="btn btn-warning btn-sm">Restart <i class="la la-refresh"></i></button></a></td>
</tr>
{% endfor %}
Expand All @@ -56,21 +54,21 @@ <h2>Background Tasks</h2>
</div>

<div class="col-md-12">

<table class="table table-bordered table-hover">
<tr>
<th>Name</th>
<th>Name</th>
<th>Status</th>
<th>Logs</th>
<th>Actions</th>
</tr>
<tr>
<td>Combine Background Tasks</td>
<td>Combine Background Tasks</td>
<td class="{% if celery_status == 'idle' %}bg_light_green{% else %}bg_light_red{% endif %}">{{celery_status}}</td>
<td>{% if COMBINE_DEPLOYMENT != 'docker' %}<a target="_blank" href="{% url 'bgtasks_proc_stderr_log' %}"><button type="button" class="btn btn-info btn-sm">View Logs Snippet</button></a>{% else %}<button type="button" class="btn btn-info btn-sm" disabled>Logs not available in Docker</button>{% endif %}</td>
<td>{% if COMBINE_DEPLOYMENT != 'docker' %}{% if bgtasks_proc.statename == 'RUNNING' or bgtasks_proc.statename == 'STARTING'%}<a href="{% url 'bgtasks_proc_action' proc_action='stop' %}"><button type="button" class="btn btn-danger btn-sm">Stop <i class="la la-close"></i></button></a> <a href="{% url 'bgtasks_proc_action' proc_action='restart' %}"><button type="button" class="btn btn-warning btn-sm">Restart <i class="la la-refresh"></i></button></a>{% else %}<a href="{% url 'bgtasks_proc_action' proc_action='start' %}"><button type="button" class="btn btn-success btn-sm">Start <i class="la la-power-off"></i></button></a>{% endif %}{% else %}<button type="button" class="btn btn-info btn-sm" disabled>Start/Stop not available in Docker</button>{% endif %}</td>
</tr>
</table>
</table>

</div>

Expand Down

0 comments on commit 41fc17e

Please sign in to comment.