Skip to content

Commit

Permalink
Merge branch 'release/ODN_v1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Marcek committed Sep 24, 2015
2 parents 9000769 + 5d7b701 commit ff89b71
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 33 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@
Changelog
---------

v1.2.0-SNAPSHOT 2015-9-10

Features:
* if pipeline has no "normal" schedule rule and is planned after another pipeline(s), this information is properly displayed

Bug fixes:
* i18n updates
* can associate my organization pipelines; can create copy all public and my organization pipelines [OpenDataNode/open-data-node#196]
* next execution link points to concrete execution when running or queued

v1.1.2 2015-8-18

Bug fixes:
* disabling verification of UnifiedViews certificate
* i18n changes

Notes:
* Version jumped from 0.6.1 to 1.1.2 in order to align with tags / ODN releases

v0.6.1 2015-07-08

Bug fixes:
Expand Down
36 changes: 20 additions & 16 deletions ckanext/i18n/sk/LC_MESSAGES/ckanext_odn_pipeline.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ckanext-odn-pipeline 0.5.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2015-07-30 14:47+0200\n"
"POT-Creation-Date: 2015-09-10 10:51+0200\n"
"PO-Revision-Date: 2015-03-10 13:27+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: sk <LL@li.org>\n"
Expand Down Expand Up @@ -75,9 +75,9 @@ msgid "Couldn't create/associate pipeline: {error}"
msgstr "Nepodarilo sa vytvoriť/priradiť proces: {error}"

#: ckanext/controllers/pipeline.py:239 ckanext/controllers/pipeline.py:391
#: ckanext/controllers/pipeline.py:422 ckanext/pipeline/plugin.py:84
#: ckanext/pipeline/plugin.py:98 ckanext/pipeline/plugin.py:197
#: ckanext/pipeline/plugin.py:221
#: ckanext/controllers/pipeline.py:422 ckanext/pipeline/plugin.py:87
#: ckanext/pipeline/plugin.py:101 ckanext/pipeline/plugin.py:200
#: ckanext/pipeline/plugin.py:232
msgid "Connecting to UnifiedViews timed out."
msgstr "Vypršal čas pre pripojenie sa k Transformačnému modulu."

Expand Down Expand Up @@ -113,27 +113,31 @@ msgstr "internal api: Neúspešná autentifikácia."
msgid "Error: Only logged in user can associate pipelines."
msgstr "Chyba: Len prihlásený používateľ môže priraďovať procesy."

#: ckanext/pipeline/plugin.py:75
#: ckanext/pipeline/plugin.py:78
msgid "Couldn't retrieve information about pipelines: {error}"
msgstr "Nepodarilo sa získať informácia o procesoch: {error}"
msgstr "Nepodarilo sa získať informáciu o procesoch: {error}"

#: ckanext/pipeline/plugin.py:80
#: ckanext/pipeline/plugin.py:83
msgid "Couldn't retrieve information about pipelines."
msgstr "Nepodarilo sa získať informácia o procesoch."
msgstr "Nepodarilo sa získať informáciu o procesoch."

#: ckanext/pipeline/plugin.py:95
#: ckanext/pipeline/plugin.py:98
msgid "Couldn't retrieve pipeline information: {error}"
msgstr "Nepodarilo sa získať informácie o procese: {error}"
msgstr "Nepodarilo sa získať informáciu o procese: {error}"

#: ckanext/pipeline/plugin.py:164
#: ckanext/pipeline/plugin.py:167
msgid "Couldn't connect to UnifiedViews server."
msgstr "Nepodarilo sa spojiť so serverom Transformačného modulu"

#: ckanext/pipeline/plugin.py:194
#: ckanext/pipeline/plugin.py:197
msgid "Couldn't get pipeline last execution information: {error}"
msgstr "Nepodarilo sa získať informáciu o poslednom spustení procesu: {error}"

#: ckanext/pipeline/plugin.py:218
#: ckanext/pipeline/plugin.py:225
msgid "After pipeline(s) with name: '{0}'"
msgstr "Po procese(och) s názvom: '{0}'"

#: ckanext/pipeline/plugin.py:229
msgid "Couldn't get pipeline next execution information: {error}"
msgstr "Nepodarilo sa získať informáciu o ďalšom spustení procesu: {error}"

Expand Down Expand Up @@ -163,8 +167,8 @@ msgid "Execute now"
msgstr "Spustiť teraz"

#: ckanext/pipeline/templates/package/pipelines.html:46
msgid "Remove"
msgstr "Odstrániť"
msgid "Disassociate"
msgstr "Zrušiť asociáciu"

#: ckanext/pipeline/templates/package/pipelines.html:60
msgid "Last execution: {time}, last run status: "
Expand Down Expand Up @@ -266,7 +270,7 @@ msgstr "Meno"

#: ckanext/pipeline/templates/pipeline/create_pipeline.html:22
msgid "Pipeline name"
msgstr "Meno procesu"
msgstr "Názov procesu"

#: ckanext/pipeline/templates/pipeline/create_pipeline.html:23
msgid "Description"
Expand Down
27 changes: 18 additions & 9 deletions ckanext/pipeline/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def allows_create_pipe():
return pipeline_allow_create

# Our custom template helper function.
def get_all_pipelines():
def get_all_pipelines(only_visible=False):
assert uv_api_url
try:
if c.userobj:
Expand All @@ -69,7 +69,10 @@ def get_all_pipelines():
return []

uv_api = UVRestAPIWrapper(uv_api_url, uv_api_auth)
pipes = uv_api.get_pipelines(user_external_id)
if only_visible:
pipes = uv_api.get_visible_pipelines(user_external_id)
else:
pipes = uv_api.get_pipelines(user_external_id)
return pipes
except urllib2.HTTPError, e:
error_msg =_("Couldn't retrieve information about pipelines: {error}").format(error=e.msg)
Expand Down Expand Up @@ -208,11 +211,19 @@ def add_next_exec_info(pipe_id, pipe):
error_msg = None
try:
uv_api = UVRestAPIWrapper(uv_api_url, uv_api_auth)
schedule_id, next_exec, next_exec_status = uv_api.get_next_execution_info(pipe_id)
exec_or_schedule_id, next_exec, next_exec_status, after_pipelines = uv_api.get_next_execution_info(pipe_id)

pipe['next_exec'] = format_date(next_exec)
pipe['next_exec_status'] = STATUSES[next_exec_status]
pipe['next_exec_sched_url'] = '{0}/#!Scheduler'.format(uv_url) # TODO link to schedule

if next_exec_status and exec_or_schedule_id: # execution is queued or running
pipe['next_exec_sched_url'] = '{0}/#!ExecutionList/exec={1}'.format(uv_url, exec_or_schedule_id)
else: # is only scheduled
pipe['next_exec_sched_url'] = '{0}/#!Scheduler'.format(uv_url) # TODO link to schedule

if after_pipelines:
pipe['next_exec'] = _(u"After pipeline(s) with name: '{0}'").format(u"', '".join(after_pipelines))

return
except urllib2.HTTPError, e:
error_msg =_("Couldn't get pipeline next execution information: {error}")\
Expand All @@ -229,7 +240,7 @@ def get_available_pipes_options():


def get_all_pipes_options():
pipes = get_all_pipelines()
pipes = get_all_pipelines(True)
return get_options_discriptions_for(pipes)


Expand Down Expand Up @@ -275,10 +286,8 @@ def update_config(self, config):
# Tell CKAN what custom template helper functions this plugin provides,
# see the ITemplateHelpers plugin interface.
def get_helpers(self):
return {'get_pipeline_available': get_pipelines_not_assigned,
'get_dataset_pipelines': get_dataset_pipelines,
'allows_create_pipe': allows_create_pipe
}
return {'get_dataset_pipelines':get_dataset_pipelines,
'allows_create_pipe': allows_create_pipe}


def before_map(self, route_map):
Expand Down
2 changes: 1 addition & 1 deletion ckanext/pipeline/templates/package/pipelines.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h3 class="dataset-heading">
{% link_for _('Execute now'), controller=controller, action='execute_now', id=pkg_dict.name, pipeline_id=pipe['id'] %}
</li>
<li>
{% link_for _('Remove'), controller=controller, action='remove_pipe', id=pkg_dict.name, pipeline_id=pipe['id'] %}
{% link_for _('Disassociate'), controller=controller, action='remove_pipe', id=pkg_dict.name, pipeline_id=pipe['id'] %}
</li>
</ul>
</div>
Expand Down
26 changes: 20 additions & 6 deletions ckanext/pipeline/uv_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ def get_pipelines(self, user_id=None):
return self._send_request(uv_url)


def get_visible_pipelines(self, user_id=None):
uv_url = '{0}/pipelines/visible'.format(self.url)
if user_id:
uv_url = '{0}?{1}={2}'.format(uv_url, USER_EXT_ID, user_id)
return self._send_request(uv_url)


def get_pipeline_by_id(self, pipe_id):
assert pipe_id
uv_url = '{0}/pipelines/{1}'.format(self.url, pipe_id)
Expand Down Expand Up @@ -163,17 +170,24 @@ def get_next_execution_info(self, pipe_id):
executions = self._send_request(uv_url)
if executions and len(executions) > 0:
execution = executions.pop(0)
return execution['schedule'], execution['lastChange'], execution['status']
return execution['id'], execution['lastChange'], execution['status'], None

# if there is no pending execution, get next execution from schedules
uv_url = "{0}/pipelines/{1}/schedules/~all/scheduledexecutions".format(self.url, pipe_id)
schedules = self._send_request(uv_url)
if schedules and len(schedules) > 0:
schedule = schedules.pop(0)
return schedule['schedule'], schedule['start'], None
if schedules:
if not schedules[0]['afterPipelines']:
schedule = schedules.pop(0) # its already sorted by start time
return schedule['schedule'], schedule['start'], None, None
else:
after_pipes = []
for schedule in schedules:
after_pipes += schedule['afterPipelines'].values()
return None, None, None, after_pipes


return None, None, None, None

return None, None, None


def execute_now(self, pipe_id, is_debugging=False, user_id=None, user_actor_id=None):
assert pipe_id
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

version = '1.1.2'
version = '1.2.0'

setup(
name='ckanext-odn-pipeline',
Expand Down

0 comments on commit ff89b71

Please sign in to comment.