Skip to content

Commit

Permalink
h2calc, tasks, jwt/user updates
Browse files Browse the repository at this point in the history
  • Loading branch information
samwachspress committed Apr 5, 2021
1 parent 4a96390 commit c060dc4
Show file tree
Hide file tree
Showing 30 changed files with 1,455 additions and 381 deletions.
1 change: 1 addition & 0 deletions base/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class PRICES:

GOOGLE_CLOUD_BUCKET = 'elegansvariation.org'
GOOGLE_CLOUD_PROJECT_ID = 'andersen-lab'
GOOGLE_CLOUD_LOCATION = 'us-central1'

# WI Strain Info Dataset
GOOGLE_SHEETS = {"orders": "1BCnmdJNRjQR3Bx8fMjD_IlTzmh3o7yj8ZQXTkk6tTXM",
Expand Down
27 changes: 27 additions & 0 deletions base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,33 @@ def save(self, *args, **kwargs):
super(markdown_ds, self).save(*args, **kwargs)



class h2calc_ds(datastore_model):
"""
The Heritability Calculation Task Model - for creating and retrieving
data and status information about a heritability calculation task
executed in Google Cloud Run
"""
kind = 'h2calc'
kind = '{}{}'.format(config['DS_PREFIX'], kind)


def __init__(self, *args, **kwargs):
super(h2calc_ds, self).__init__(*args, **kwargs)

def query_by_username(self, username, keys_only=False):
filters = [('username', '=', username)]
results = query_item(self.kind, filters=filters, keys_only=keys_only)
return results

def save(self, *args, **kwargs):
now = arrow.utcnow().datetime
self.modified_on = now
if not self._exists:
self.created_on = now
super(h2calc_ds, self).save(*args, **kwargs)


class data_report_ds(datastore_model):
"""
The Data Report model - for creating and retrieving
Expand Down
6 changes: 6 additions & 0 deletions base/queue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
queue:
- name: heritability-calc
rate: 1/s
retry_parameters:
task_retry_limit: 2
task_age_limit: 1d
21 changes: 14 additions & 7 deletions base/templates/data_v2.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
{% extends "_layouts/default.html" %} {% block custom_head %}
{% extends "_layouts/default.html" %}

{% block custom_head %}

<style>
#checkout.affix {
position: fixed;
top: 20px;
width: 136px;
position: fixed;
top: 20px;
width: 136px;
}
body, html{
width: 100%;
height: 100%;
width: 100%;
height: 100%;
}
</style>

{% endblock %}


{% block content %}

<div class="row">
<div class="col-md-12">
<ul class="nav nav-pills">
Expand Down Expand Up @@ -256,9 +261,10 @@ <h2>Datasets</h2>
</div>{# /Download Tab #}



{% endblock %}

{% block script %}

<script>
$(document).ready(function() {

Expand Down Expand Up @@ -299,5 +305,6 @@ <h2>Datasets</h2>


</script>

{% endblock %}

50 changes: 50 additions & 0 deletions base/templates/tools/h2_result_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{% extends "_layouts/default.html" %}

{% block content %}

<div class="row">
<div class="col-md-10">
</div> <!-- /col-md-10 -->
<div class="col-md-2">
<a id='create' value="create" type='submit' href="{{ url_for('heritability.heritability_create') }}" class="btn btn-primary btn-block">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
New Calculation
</a>
</div> <!-- /col-md-2 -->
</div> <!-- /row -->

<div class="row">
<div class="col-md-12">
<table>
<thead>
<tr class="header">
<th><strong> Label </strong></th>
<th><strong> Data Hash </strong></th>
<th><strong> Status </strong></th>
<th><strong> Created: </strong></th>
<th><strong> </strong></th>
</tr>
</thead>
<tbody>
{% for item in items %}
<tr>
{% if item %}
<td> {{ item.label }} </td>
<td> {{ item.data_hash }} </td>
<td> {{ item.status }} </td>
<td> {{ item.created_on }} </td>
<td>
<a href="{{ url_for('heritability.heritability_result', id=item.key.name) }}">
View
</a>
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div> <!-- /col-md-12 -->
</div> <!-- /row -->


{% endblock %}
Loading

0 comments on commit c060dc4

Please sign in to comment.