Skip to content

Commit

Permalink
css and job tweeks
Browse files Browse the repository at this point in the history
  • Loading branch information
sdc50 committed Jan 29, 2016
1 parent 41c30af commit 17b0af5
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tethys_apps/static/tethys_apps/css/app_library.css
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ body {
width: 25px;
}
#app-list .app-container .app-help-info {
overflow-y: scroll;
overflow-y: auto;
background-color: white;
color: #666666;
font-size: 14px;
Expand Down
2 changes: 1 addition & 1 deletion tethys_apps/static/tethys_apps/less/app_library.less
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ body {
}

.app-help-info {
overflow-y: scroll;
overflow-y: auto;
background-color: white;
color: #666666;
font-size: 14px;
Expand Down
15 changes: 15 additions & 0 deletions tethys_apps/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from tethys_apps.app_harvester import SingletonAppHarvester
from tethys_apps.base.app_base import TethysAppBase

from tethys_compute.models import TethysJob


@login_required()
def library(request):
Expand Down Expand Up @@ -121,3 +123,16 @@ def send_beta_feedback_email(request):
json = {'success': True,
'result': 'Emails sent to specified developers'}
return JsonResponse(json)

def update_job_status(request, job_id):
"""
Callback endpoint for jobs to update status.
"""
try:
job = TethysJob.objects.filter(id=job_id)[0]
job.status
json = {'success': True}
except Exception, e:
json = {'success': False}

return JsonResponse(json)
9 changes: 9 additions & 0 deletions tethys_compute/job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* License: BSD 2-Clause
********************************************************************************
"""
from django.core.urlresolvers import reverse
from tethys_compute.models import TethysJob, CondorJob, BasicJob
import re

Expand Down Expand Up @@ -70,6 +71,14 @@ def get_job(self, job_id, user=None):

return job

def get_job_status_callback_url(self, request, job_id):
"""
Get the absolute url to call to update job status
"""
relative_uri = reverse('update_job_status', kwargs={'job_id': job_id})
absolute_uri = request.build_absolute_uri(relative_uri)
return absolute_uri

def _replace_workspaces(self, parameters, user_workspace):
"""
Replaces all instances of '$(APP_WORKSPACE)' and '$(USER_WORKSPACE)' in job parameters with the actual paths.
Expand Down
23 changes: 22 additions & 1 deletion tethys_compute/scheduler_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,25 @@ def get_scheduler(name):
"""
schedulers = Scheduler.objects.filter(name=name)
if schedulers:
return schedulers[0]
return schedulers[0]

def create_scheduler(name, host, username=None, password=None, private_key_path=None, private_key_pass=None):
"""
Creates a new scheduler
Args:
name (str): The name of the scheduler
host (str): The hostname or IP address of the scheduler
username (str, optional): The username to use when connecting to the scheduler
password (str, optional): The password for the username
private_key_path (str, optional): The path to the location of the SSH private key file
private_key_pass (str, optional): The passphrase for the private key
Returns:
The newly created scheduler
Note:
The newly created scheduler object is not committed to the database.
"""
scheduler = Scheduler(name, host, username, password, private_key_path, private_key_pass)
return scheduler
1 change: 1 addition & 0 deletions tethys_portal/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
url(r'^developer/', include(developer_urls)),
url(r'^handoff/(?P<app_name>[\w-]+)/$', tethys_apps_views.handoff_capabilities, name='handoff_capabilities'),
url(r'^handoff/(?P<app_name>[\w-]+)/(?P<handler_name>[\w-]+)/$', tethys_apps_views.handoff, name='handoff'),
url(r'^update-job-status/(?P<job_id>[\w-]+)/$', tethys_apps_views.update_job_status, name='update_job_status'),
#url(r'^error/', include(development_error_urls)),
]

Expand Down
5 changes: 3 additions & 2 deletions tethys_sdk/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
* License: BSD 2-Clause
********************************************************************************
"""
from tethys_compute.scheduler_manager import list_schedulers, get_scheduler
from tethyscluster.config import get_cluster_manager
from tethys_compute.scheduler_manager import list_schedulers, get_scheduler, create_scheduler
from tethyscluster.config import get_cluster_manager

0 comments on commit 17b0af5

Please sign in to comment.