Skip to content

Commit

Permalink
Merge branch 'master' into list-inputs
Browse files Browse the repository at this point in the history
* master: (48 commits)
  Update the Changelog.
  Bump version number.
  Factor out the interactions handler in the worker code.
  Document the new connection configuration option.
  [TAV-522] Configure number of network error retries.
  [TAV-522] Handle network level errors (retry).
  Fix the "fail in post run callback" worker test.
  Factor out run creation in the worker.
  Use the latest t2-server client library.
  Update the Changelog.
  Bump version number.
  Use an SVG badge for CodeClimate in the ReadMe.
  Add a routing test for the workflows controller.
  Output JSON for the workflows controller.
  Add specific tests for the ModelProxy class.
  Ensure the proxied models use a rooted (::) namespace.
  Update the ReadMe with new workflow model infomation.
  Set the workflow model proxy more simply.
  Add the internal Workflow stubs to the generators.
  Allow extending of the internal Workflow controller.
  ...
  • Loading branch information
hainesr committed Oct 31, 2014
2 parents bf7512f + c9cebaf commit 13729ab
Show file tree
Hide file tree
Showing 55 changed files with 982 additions and 300 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ rvm:
- 1.9.3
- 2.0.0
- 2.1.2
- rbx-2
- ruby-head
script:
- RAILS_ENV=test bundle exec rake db:schema:load
- bundle exec rake test
matrix:
allow_failures:
- rvm: rbx-2
- rvm: ruby-head
38 changes: 38 additions & 0 deletions CHANGES.rdoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
= Changes log for Taverna Player

== Version 0.10.0

* Use the latest t2-server client library.
* Factor out run creation in the worker.
* Fix the "fail in post run callback" worker test.
* [TAV-522] Handle network level errors (retry).
* [TAV-522] Configure number of network error retries.
* Document the new connection configuration option.
* Factor out the interactions handler in the worker code.

== Version 0.9.0

* Add a test to check if a Run's delayed_job has failed.
* Destroy failed delayed_jobs when destroying Runs.
* Add a CITATION file.
* Test cancelling a Run before it starts running.
* Add Run#pending?
* Add Run#initialized?
* Add Run#incomplete?
* Allow cancelling a run if its delayed_job fails.
* Add a test for Run#initialized?
* Use the latest t2flow gem for the tests.
* Add a default Workflow model.
* Fix up the user proxy for tests vs the dev app.
* Update the installer templates.
* Refactor ModelProxy so constantization is delayed.
* Set the internal Workflow model to be the default.
* Only route TavernaPlayer::Workflow if it is in use.
* Allow extending of the internal Workflow model.
* Allow extending of the internal Workflow controller.
* Add the internal Workflow stubs to the generators.
* Set the workflow model proxy more simply.
* Update the ReadMe with new workflow model infomation.
* Ensure the proxied models use a rooted (::) namespace.
* Add specific tests for the ModelProxy class.
* Output JSON for the workflows controller.
* Add a routing test for the workflows controller.

== Version 0.8.0

* Add a note about Taverna Server compatibility to the ReadMe.
Expand Down
20 changes: 20 additions & 0 deletions CITATION
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
To cite Taverna-Player in your publication please use:

Katherine Wolstencroft, Robert Haines, Donal Fellows, Alan Williams,
David Withers, Stuart Owen, Stian Soiland-Reyes, Ian Dunlop,
Aleksandra Nenadic, Paul Fisher, Jiten Bhagat, Khalid Belhajjame, Finn Bacall,
Alex Hardisty, Abraham Nieva de la Hidalga, Maria P Balcazar Vargas,
Shoaib Sufi, Carole Goble. The Taverna workflow suite: designing and
executing workflows of Web Services on the desktop, web or in the cloud in
Nucleic acids research, 2013, Volume 41, Issue W1, pp W557-W561.

@article{wolstencroft2013taverna,
title={The Taverna workflow suite: designing and executing workflows of Web Services on the desktop, web or in the cloud},
author={Wolstencroft, Katherine and Haines, Robert and Fellows, Donal and Williams, Alan and Withers, David and Owen, Stuart and Soiland-Reyes, Stian and Dunlop, Ian and Nenadic, Aleksandra and Fisher, Paul and others},
journal={Nucleic acids research},
volume={41},
number={W1},
pages={W557--W561},
year={2013},
publisher={Oxford University Press}
}
12 changes: 0 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
source "https://rubygems.org"

# Declare your gem's dependencies in taverna_player.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

# These gems are used by the dummy application
gem "jquery-rails"
gem "taverna-t2flow", "~> 0.4.5"

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

# To use debugger
# gem 'debugger'
60 changes: 43 additions & 17 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Licence:: BSD (See LICENCE or http://www.opensource.org/licenses/bsd-license
Copyright:: (c) 2013, 2014 The University of Manchester, UK

{<img src="https://badge.fury.io/rb/taverna-player.svg" alt="Gem Version" />}[http://badge.fury.io/rb/taverna-player]
{<img src="https://codeclimate.com/github/myGrid/taverna-player.png" />}[https://codeclimate.com/github/myGrid/taverna-player]
{<img src="https://codeclimate.com/github/myGrid/taverna-player/badges/gpa.svg" />}[https://codeclimate.com/github/myGrid/taverna-player]
{<img src="https://travis-ci.org/myGrid/taverna-player.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/myGrid/taverna-player]
{<img src="https://coveralls.io/repos/myGrid/taverna-player/badge.png?branch=master" alt="Coverage Status" />}[https://coveralls.io/r/myGrid/taverna-player?branch=master]

Expand All @@ -22,9 +22,8 @@ Taverna Player handles all aspects of running a workflow including:
* Presenting workflow interactions to the user
* Gathering and download of workflow outputs

It, purposefully, does not:
* Manage workflows
* Manage users
It, purposefully, does not manage users and its default workflow model is
intentionally oversimplified.

== Prerequisites

Expand Down Expand Up @@ -109,9 +108,10 @@ Mount the Taverna Player engine in your <tt>config/routes.rb</tt>. For example:

mount TavernaPlayer::Engine, :at => "/"

Taverna Player provides three resources with paths:
Taverna Player provides four resources with paths:

* <tt>/runs/*</tt>
* <tt>/workflows/*</tt>
* <tt>/service_credentials/*</tt>
* <tt>/job_queue</tt>

Expand All @@ -129,11 +129,18 @@ set (for example):
And the resource paths would become:

* <tt>/runs/*</tt>
* <tt>/workflows/*</tt>
* <tt>/admin/service_credentials/*</tt>
* <tt>/admin/job_queue</tt>

You can also nest the Taverna Player runs resources within your workflows
resources if you wish, like this:
The supplied workflow model also nests the run resources within it:

* <tt>/workflows</tt>
* <tt>/workflows/{workflow-id}/runs/*</tt>

If you override the default workflow model (see below for details) you can
also nest the Taverna Player runs resources within your workflows resources if
you wish, like this (within your application's <tt>config/routes.rb</tt>):

resources :workflows do
resources :runs, :controller => "TavernaPlayer::Runs", :except => :edit
Expand Down Expand Up @@ -198,13 +205,13 @@ so that they take precedence over the default ones. You can delete any that you
do not need to customize but there are no penalties for leaving them there.
There is more information on overriding controllers below.

If you need to override the Taverna Player Run model, to add columns to the
table for example, you can copy a customizable stub with:
If you need to override any Taverna Player models, to add columns to a table
for example, you can copy customizable stubs with:

rails generate taverna_player:models

The stub is copied to the <tt>app/models/taverna_player</tt> directory so that
it takes precedence over the default one. There is more information on
The stubs are copied to the <tt>app/models/taverna_player</tt> directory so
that they take precedence over the defaults. There is more information on
overriding models below.

If you want to use pre- and post-run callbacks you can setup some basic stubs
Expand All @@ -229,16 +236,17 @@ information on renderers below.
== Taverna Player initializers

Two initializers are installed by the install generator:
* {taverna_player.rb}[https://github.com/myGrid/taverna-player/blob/master/lib/generators/templates/player_initializer.rb]:
* {config/initializers/taverna_player.rb}[https://github.com/myGrid/taverna-player/blob/master/lib/generators/templates/player_initializer.rb]:
This contains configuration of Taverna Player.
* {taverna_server.rb.example}[https://github.com/myGrid/taverna-player/blob/master/lib/generators/templates/server_initializer.rb]:
* {config/initializers/taverna_server.rb.example}[https://github.com/myGrid/taverna-player/blob/master/lib/generators/templates/server_initializer.rb]:
This is used to configure Taverna Player's connection to a Taverna Server.
It is initially set up as an example file as you will need to distribute
this with your application but you must not check in the contents of the
configured version to your repository.

Both of these files require minimal configuration for simple set ups and are
fully commented with everything that needs to be set - more details below.
Both of these files <b>require minimal configuration</b> for simple set ups
and are fully commented with everything that needs to be set - more details
below.

=== Essential (required) configuration

Expand All @@ -252,6 +260,10 @@ called "file_name" then the following will configure this correctly:
proxy.file_method_name = :file_name
end

Taverna Player has a very simple internal workflow model
(TavernaPlayer::Workflow) that you can extend (see below) or replace with the
above code.

Secondly, Taverna Player needs to know where your Taverna Server is and how to
authenticate to it:

Expand Down Expand Up @@ -301,7 +313,19 @@ that make use of interactions (so you have users watching the workflows
running) then it should probably be set lower.

There are a number of options for configuring the connection to the Taverna
Server. These are actually provided by the underlying
Server. The first specifies how many times an initial connection to Taverna
Server will be retried if there are any low level network errors.

config.server_connection_error_retries = 5

These can be events such as timeouts, broken connections, refused connections
or anything else out of our control. If such an error is detected Taverna
Player will back off for the amount of time specified by
<tt>config.server_retry_interval</tt> before retrying. If the maximum number of
retries is reached and there is still an error then the run will fail; the
network error message will be recorded as the reason for the run's failure.

The rest of the connection options are actually provided by the underlying
{t2-server client library}[https://rubygems.org/gems/t2-server] and surfaced
here for extra control. They are
{documented in more detail}[http://mygrid.github.io/t2-server-gem/] elsewhere
Expand Down Expand Up @@ -395,7 +419,9 @@ You can override the following core components:
* RunPort (model)
* RunPort::Input (model)
* RunPort::Output (model)
* Workflow (model)
* RunsController
* WorkflowController
* ServiceCredentialsController
* JobQueueController

Expand Down Expand Up @@ -466,7 +492,7 @@ An example callback that just prints out the run's name and workflow id would
be:

def player_run_callback(run)
w = Workflow.find(run.workflow_id)
w = TavernaPlayer::Workflow.find(run.workflow_id)
puts "Callback called for run '#{run.name}' of workflow '#{w.id}'"
end

Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
"app/models/taverna_player/run.rb",
"app/models/taverna_player/run_port.rb",
"app/models/taverna_player/service_credential.rb",
"app/models/taverna_player/workflow.rb",
"lib/taverna-player.rb",
"lib/taverna_player/port_renderer.rb"
]
Expand Down
18 changes: 18 additions & 0 deletions app/controllers/taverna_player/workflows_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#------------------------------------------------------------------------------
# Copyright (c) 2013, 2014 The University of Manchester, UK.
#
# BSD Licenced. See LICENCE.rdoc for details.
#
# Taverna Player was developed in the BioVeL project, funded by the European
# Commission 7th Framework Programme (FP7), through grant agreement
# number 283359.
#
# Author: Robert Haines
#------------------------------------------------------------------------------

module TavernaPlayer
class WorkflowsController < TavernaPlayer::ApplicationController
# See lib/taverna_player/concerns/controllers/workflows_controller.rb
include TavernaPlayer::Concerns::Controllers::WorkflowsController
end
end
4 changes: 2 additions & 2 deletions app/helpers/taverna_player/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# Copyright (c) 2013 The University of Manchester, UK.
# Copyright (c) 2013, 2014 The University of Manchester, UK.
#
# BSD Licenced. See LICENCE.rdoc for details.
#
Expand Down Expand Up @@ -44,7 +44,7 @@ def workflow_id(id_or_model)
case id_or_model
when TavernaPlayer::Run
id_or_model.workflow_id
when TavernaPlayer.workflow_proxy.class_name
when TavernaPlayer.workflow_proxy.class_const
id_or_model.id
else
id_or_model
Expand Down
38 changes: 35 additions & 3 deletions app/models/taverna_player/run.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
# Copyright (c) 2013 The University of Manchester, UK.
# Copyright (c) 2013, 2014 The University of Manchester, UK.
#
# BSD Licenced. See LICENCE.rdoc for details.
#
Expand Down Expand Up @@ -36,8 +36,9 @@ class Run < ActiveRecord::Base
# :call-seq:
# complete? -> boolean
#
# Is this run complete? If a run is finished or cancelled or failed or
# has timed out then it is complete.
# Is this run complete? If a run is finished or cancelled or failed or its
# underlying worker has failed or it has timed out then it is complete.
# #complete? is not quite the direct opposite of #incomplete?

##
# :method: embedded?
Expand Down Expand Up @@ -76,13 +77,44 @@ class Run < ActiveRecord::Base
#
# A run will have a parent if it is a child run as part of a sweep.

##
# :method: incomplete?
# :call-seq:
# incomplete? -> boolean
#
# Is this run incomplete? If a run is pending or initialized or running
# then it is incomplete. #incomplete? is not quite the direct opposite of
# #complete?

##
# :method: initialized?
# :call-seq:
# initialized? -> boolean
#
# Is this run initialized on Taverna Server but not running yet?

##
# :method: job_failed?
# :call-seq:
# job_failed? -> boolean
#
# Did the delayed_job worker running this run fail? This is primarily
# intended for internal use only at the moment.

##
# :method: name
# :call-seq:
# name -> string
#
# The name (mnemonic) of this run.

##
# :method: pending?
# :call-seq:
# pending? -> boolean
#
# Is this run in the queue?

##
# :method: root_ancestor
# :call-seq:
Expand Down
41 changes: 41 additions & 0 deletions app/models/taverna_player/workflow.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#------------------------------------------------------------------------------
# Copyright (c) 2013, 2014 The University of Manchester, UK.
#
# BSD Licenced. See LICENCE.rdoc for details.
#
# Taverna Player was developed in the BioVeL project, funded by the European
# Commission 7th Framework Programme (FP7), through grant agreement
# number 283359.
#
# Author: Robert Haines
#------------------------------------------------------------------------------

module TavernaPlayer

# This class represents a workflow. It is provided as an example model and
# can be extended or replaced as required.
#
# To replace the model completely please read about configuring the workflow
# model proxy in the "Taverna Player initializers" section of the ReadMe. To
# extend the model please read about "Overriding the default models and
# controllers" in the ReadMe.
class Workflow < ActiveRecord::Base
include TavernaPlayer::Concerns::Models::Workflow

##
# :method: inputs
# :call-seq:
# inputs -> Hash
#
# Return a hash of information about this workflow's inputs. The fields
# provided are:
# * <tt>:name</tt> - The name of the input port.
# * <tt>:description</tt> - A textual description (if provided) of the
# input port.
# * <tt>:example</tt> - Example input data (if provided) for the input
# port.
#
# All data is read directly from the workflow file itself.

end
end
1 change: 1 addition & 0 deletions app/views/taverna_player/workflows/_info.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json.extract! workflow, :id, :title, :author, :description
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%
# Copyright (c) 2013 The University of Manchester, UK.
# Copyright (c) 2013, 2014 The University of Manchester, UK.
#
# BSD Licenced. See LICENCE.rdoc for details.
#
Expand Down
Loading

0 comments on commit 13729ab

Please sign in to comment.