Diff
Modified: branches/gianni-meandre/app/controllers/application.rb (2525 => 2526)
--- branches/gianni-meandre/app/controllers/application.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/controllers/application.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -164,7 +164,7 @@
end
def update_policy(contributable, params)
-
+ logger.debug('params RECV: '+YAML::dump(params))
# this method will return an error message is something goes wrong (empty string in case of success)
error_msg = ""
Modified: branches/gianni-meandre/app/controllers/blobs_controller.rb (2525 => 2526)
--- branches/gianni-meandre/app/controllers/blobs_controller.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/controllers/blobs_controller.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -3,10 +3,12 @@
# Copyright (c) 2007 University of Manchester and the University of Southampton.
# See license.txt for details.
+require 'file_types_handler'
+
class BlobsController < ApplicationController
before_filter :login_required, :except => [:index, :show, :download, :named_download, :statistics, :search]
- before_filter :find_blob_auth, :except => [:search, :index, :new, :create]
+ before_filter :find_blob_auth, :except => [:search, :index, :new, :create, :make_experiment]
before_filter :initiliase_empty_objects_for_new_pages, : [:new, :create]
before_filter :set_sharing_mode_variables, : [:show, :new, :create, :edit, :update]
@@ -63,6 +65,9 @@
@viewing = Viewing.create(:contribution => @blob.contribution, :user => (logged_in? ? current_user : nil), :user_agent => request.env['HTTP_USER_AGENT'], :accessed_from_site => accessed_from_website?())
end
+ handler_class = FileTypesHandler.for_file(@blob.content_type.mime_type, @blob.content_blob.data)
+ @handler = handler_class.new(@blob.content_blob.data) unless handler_class.nil?
+
respond_to do |format|
format.html {
@@ -90,59 +95,105 @@
def edit
end
+ # GET /files/1;make_experiment
+ def make_experiment
+ #TODO: this should be done with the find_blob_auth method
+ @blob = Blob.find_by_id(params[:id])
+ e = Experiment.new
+ e.title = @blob.title+' Experiment - ' + DateTime.now.to_s
+ e.contributor = current_user
+ e.created_at = DateTime.now
+ e.updated_at = DateTime.now
+
+ workflow = Workflow.find_by_id(params[:workflow])
+ runner = Runner.find_by_id(params[:runner])
+
+ proc_class = FileTypesHandler.for_mime_type(@blob.content_type.mime_type)
+ processor = proc_class.new(@blob.content_blob.data)
+ processor.audio_files.each do |f|
+ j = Job.new
+ j.title = workflow.title + "(#{f})"
+ j.experiment = e
+ j.user = current_user
+ j.runnable = workflow
+ j.runnable_version = 1
+ j.created_at = DateTime.now
+ j.updated_at = DateTime.now
+ j.runner = runner
+ j.details = runner.details.job_type.new
+ j.details.save_inputs({params[:input]=>f})
+ j.save!
+ end
+ e.save!
+ flash[:notice] = 'Experiment Created'
+ redirect_to :action="" :controller=>'experiments', :id=>e.id
+ end
+
# POST /blobs
def create
# don't create new blob if no file has been selected
- if params[:blob][:data].size == 0
- respond_to do |format|
- flash.now[:error] = "Please select a file to upload."
- format.html { render :action ="" "new" }
+ file=params[:blob][:data]
+ if file == ''
+ file = Tempfile.new('file_import')
+ file.extend(FileUpload)
+ c = Curl::Easy.new(params[:url])
+ begin
+ c.perform
+ rescue
+ flash[:error] = "Could not download file."
+ redirect_to :action=""
+ return
end
- else
- data = ""
- params[:blob][:local_name] = params[:blob][:data].original_filename
- content_type = params[:blob][:data].content_type
- params[:blob].delete('data')
+ file.write(c.body_str)
+ content_type = c.content_type
+ file.original_filename = c.url
+ file.content_type = c.content_type.split(';').first
+ file.rewind
+ end
+ data = ""
+ content_type = file.content_type
- params[:blob][:contributor_type], params[:blob][:contributor_id] = "User", current_user.id
+ params[:blob][:local_name] = file.original_filename
+ params[:blob].delete('data')
- params[:blob][:license_id] = nil if params[:blob][:license_id] && params[:blob][:license_id] == "0"
-
- @blob = Blob.new(params[:blob])
- @blob.content_blob = ContentBlob.new(:data ="" data)
+ params[:blob][:contributor_type], params[:blob][:contributor_id] = "User", current_user.id
- @blob.content_type = ContentType.find_by_mime_type(content_type)
+ params[:blob][:license_id] = nil if params[:blob][:license_id] && params[:blob][:license_id] == "0"
+
+ @blob = Blob.new(params[:blob])
+ @blob.content_blob = ContentBlob.new(:data ="" data)
- if @blob.content_type.nil?
- @blob.content_type = ContentType.create(:user_id => current_user.id, :mime_type => content_type, :title => content_type)
- end
+ @blob.content_type = ContentType.find_by_mime_type(content_type)
- respond_to do |format|
- if @blob.save
- if params[:blob][:tag_list]
- @blob.tags_user_id = current_user
- @blob.tag_list = convert_tags_to_gem_format params[:blob][:tag_list]
- @blob.update_tags
- end
- # update policy
- @blob.contribution.update_attributes(params[:contribution])
-
- policy_err_msg = update_policy(@blob, params)
-
- update_credits(@blob, params)
- update_attributions(@blob, params)
-
- if policy_err_msg.blank?
- flash[:notice] = 'File was successfully created.'
- format.html { redirect_to file_url(@blob) }
- else
- flash[:notice] = "File was successfully created. However some problems occurred, please see these below.</br></br><span style='color: red;'>" + policy_err_msg + "</span>"
- format.html { redirect_to :controller => 'blobs', :id => @blob, :action ="" "edit" }
- end
+ if @blob.content_type.nil?
+ @blob.content_type = ContentType.create(:user_id => current_user.id, :mime_type => content_type, :title => content_type)
+ end
+
+ respond_to do |format|
+ if @blob.save
+ if params[:blob][:tag_list]
+ @blob.tags_user_id = current_user
+ @blob.tag_list = convert_tags_to_gem_format params[:blob][:tag_list]
+ @blob.update_tags
+ end
+ # update policy
+ @blob.contribution.update_attributes(params[:contribution])
+
+ policy_err_msg = update_policy(@blob, params)
+
+ update_credits(@blob, params)
+ update_attributions(@blob, params)
+
+ if policy_err_msg.blank?
+ flash[:notice] = 'File was successfully created.'
+ format.html { redirect_to file_url(@blob) }
else
- format.html { render :action ="" "new" }
+ flash[:notice] = "File was successfully created. However some problems occurred, please see these below.</br></br><span style='color: red;'>" + policy_err_msg + "</span>"
+ format.html { redirect_to :controller => 'blobs', :id => @blob, :action ="" "edit" }
end
+ else
+ format.html { render :action ="" "new" }
end
end
end
Modified: branches/gianni-meandre/app/controllers/experiments_controller.rb (2525 => 2526)
--- branches/gianni-meandre/app/controllers/experiments_controller.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/controllers/experiments_controller.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -3,13 +3,16 @@
# Copyright (c) 2008 University of Manchester and the University of Southampton.
# See license.txt for details.
+require 'delayed_job'
+
class ExperimentsController < ApplicationController
before_filter :login_required
before_filter :find_experiments, : [:index]
- before_filter :find_experiment_auth, : [:show, :edit, :update, :destroy]
+ before_filter :find_experiment_auth, : [:show, :edit, :update, :destroy, :run_all]
+
def index
respond_to do |format|
format.html # index.rhtml
@@ -85,6 +88,19 @@
end
end
end
+
+ def run_all
+ errors = []
+ @experiment.jobs.each do |j|
+ j.queue
+ end
+ if errors.empty?
+ flash[:notice] = 'All jobs have been submitted successfully'
+ else
+ flash[:error] = errors.join("<br/>")
+ end
+ redirect_to :action=""
+ end
protected
@@ -122,6 +138,7 @@
error("Experiment not found or action not authorized", "is invalid (not authorized)")
end
end
+
private
Modified: branches/gianni-meandre/app/controllers/jobs_controller.rb (2525 => 2526)
--- branches/gianni-meandre/app/controllers/jobs_controller.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/controllers/jobs_controller.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -3,6 +3,8 @@
# Copyright (c) 2008 University of Manchester and the University of Southampton.
# See license.txt for details.
+require 'delayed_job'
+
class JobsController < ApplicationController
before_filter :login_required
@@ -63,7 +65,6 @@
# Set defaults
@job.title = Job.default_title(current_user)
@job.runnable_type = "Workflow"
- @job.runner_type = "TavernaEnactor"
@job.runnable_id = params[:runnable_id] if params[:runnable_id]
@job.runnable_version = params[:runnable_version] if params[:runnable_version]
@@ -72,13 +73,7 @@
# At the moment: only Taverna 1 workflows are allowed.
if params[:runnable_id]
runnable = Workflow.find(:first, :conditions => ["id = ?", params[:runnable_id]])
- if runnable
- if runnable.processor_class != WorkflowProcessors::TavernaScufl
- flash[:error] = "Note that the workflow specified to run in this job is currently not supported and will prevent the job from being created. Specify a Taverna 1 workflow instead."
- end
-
- # TODO: check that the specified version of the workflow exists so that a warning can be given.
- else
+ unless runnable
flash[:error] = "Note that the workflow specified to run in this job does not exist. Specify a different workflow."
end
end
@@ -94,24 +89,14 @@
# Hard code certain values, for now.
params[:job][:runnable_type] = 'Workflow'
- params[:job][:runner_type] = 'TavernaEnactor'
@job = Job.new(params[:job])
@job.user = user
-
+
# Check runnable is a valid and authorized one
# (for now we can assume it's a Workflow)
runnable = Workflow.find(:first, :conditions => ["id = ?", params[:job][:runnable_id]])
- # Check that the runnable object is allowed to be run.
- # At the moment: only Taverna 1 workflows are allowed.
- if runnable
- if runnable.processor_class != WorkflowProcessors::TavernaScufl
- success = false
- err_msg = "The workflow specified to run in this job not supported. Please specify a Taverna 1 workflow instead."
- end
- end
-
if not runnable or not Authorization.is_authorized?('download', nil, runnable, user)
success = false
@job.errors.add(:runnable_id, "not valid or not authorized")
@@ -125,11 +110,13 @@
# Check runner is a valid and authorized one
# (for now we can assume it's a TavernaEnactor)
- runner = TavernaEnactor.find(:first, :conditions => ["id = ?", params[:job][:runner_id]])
+ runner = Runner.find(:first, :conditions => ["id = ?", params[:job][:runner_id]])
if not runner or not Authorization.is_authorized?('execute', nil, runner, user)
success = false
@job.errors.add(:runner_id, "not valid or not authorized")
end
+
+ @job.details = runner.details.job_type.new
success = update_parent_experiment(params, @job, user)
@@ -181,36 +168,7 @@
end
def save_inputs
- inputs_hash = { }
-
- input_ports = @job.runnable.get_input_ports(@job.runnable_version)
-
- input_ports.each do |i|
- case params["#{i.name}_input_type".to_sym]
- when "none"
- inputs_hash[i.name] = nil
- when "single"
- inputs_hash[i.name] = params["#{i.name}_single_input".to_sym]
- when "list"
- h = params["#{i.name}_list_input".to_sym]
- if h and h.is_a?(Hash)
- # Need to sort because we need to assume that order is important!
- h = h.sort {|a,b| a[0]<=>b[0]}
- vals = [ ]
- h.each do |v|
- vals << v[1]
- end
- inputs_hash[i.name] = vals
- else
- flash[:error] += "Failed to read list of inputs for port: #{i.name}. "
- end
- when "file"
- inputs_hash[i.name] = params["#{i.name}_file_input".to_sym].read
- end
- end
-
- @job.inputs_data = inputs_hash
-
+ @job.details.save_inputs(params)
respond_to do |format|
if @job.save
flash[:notice] = "Input data successfully saved" if flash[:error].blank?
@@ -238,7 +196,7 @@
end
if success
- success = @job.submit_and_run!
+ @job.queue
end
unless success
@@ -263,7 +221,7 @@
@stop_timer = (@job.allow_run? or @job.completed?)
logger.debug("Stop timer? - address@hidden")
respond_to do |format|
- format.html { render :partial => "status_info", :locals => { :job => @job, :experiment => @experiment } }
+ format.html { render :partial => "jobs/address@hidden/status_info", :locals => { :job => @job, :experiment => @experiment } }
end
end
@@ -297,8 +255,11 @@
child_job.runnable = @job.runnable
child_job.runnable_version = @job.runnable_version
child_job.runner = @job.runner
- child_job.inputs_data = @job.inputs_data
child_job.parent_job = @job
+
+ child_job.details = @job.details.class.new
+ child_job.save!
+ child_job.details.inputs_data = @job.details.inputs_data
respond_to do |format|
if child_job.save
@@ -340,7 +301,7 @@
end
def check_runner_available
- if TavernaEnactor.for_user(current_user).empty?
+ if Runner.for_user(current_user).empty?
flash[:error] = "You cannot create a job until you have access to an enactment service registered as a runner here."
respond_to do |format|
format.html { redirect_to new_runner_url }
Modified: branches/gianni-meandre/app/controllers/runners_controller.rb (2525 => 2526)
--- branches/gianni-meandre/app/controllers/runners_controller.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/controllers/runners_controller.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -39,19 +39,23 @@
end
def new
- @runner = TavernaEnactor.new
+ @runners = Runner.runner_classes
respond_to do |format|
format.html # new.rhtml
end
end
def create
- @runner = TavernaEnactor.new
+ runner_class = Runner.get_class_by_name(params[:runner_type])
+ @runner_details = runner_class.new
+ @runner = Runner.new
+ @runner.details = @runner_details
respond_to do |format|
if update_runner!(@runner)
- flash[:notice] = "Your Runner of type 'Taverna Enactor' has been successfully registered."
+ flash[:notice] = "Your Runner of type '#{runner_class.name}' has been successfully registered."
format.html { redirect_to runner_url(@runner) }
else
+ @runners = RunnersHandler.runner_classes
format.html { render :action ="" "new" }
end
end
@@ -66,7 +70,7 @@
def update
respond_to do |format|
if update_runner!(@runner)
- flash[:notice] = "Your Runner of type 'Taverna Enactor' has been successfully updated."
+ flash[:notice] = "Your Runner of type 'address@hidden' has been successfully updated."
format.html { redirect_to runner_url(@runner) }
else
format.html { render :action ="" "edit" }
@@ -96,13 +100,14 @@
def update_runner!(runner)
success = true
+
+ runner_details = params["runner_#{params[:runner_type]}".to_sym]
+
+ runner.title = runner_details[:title] if runner_details[:title]
+ runner.description = runner_details[:description] if runner_details[:description]
+
+ @runner.details.update_details(runner_details)
- runner.title = params[:runner][:title] if params[:runner][:title]
- runner.description = params[:runner][:description] if params[:runner][:description]
- runner.url = "" if params[:runner][:url]
- runner.username = params[:runner][:username] if params[:runner][:username]
- runner.password = params[:runner][:password] if params[:runner][:password]
-
if params[:assign_to_group]
network = Network.find(params[:assign_to_group_id])
if network and network.member?(current_user.id)
@@ -119,12 +124,14 @@
end
def find_runners
- @personal_runners = TavernaEnactor.find_by_contributor('User', current_user.id)
- @group_runners = TavernaEnactor.find_by_groups(current_user)
+ @personal_runners = []
+ @group_runners = []
+ @personal_runners += Runner.find_by_contributor('User', current_user.id)
+ @group_runners += Runner.find_by_groups(current_user)
end
def find_runner_auth
- runner = TavernaEnactor.find(:first, :conditions => ["id = ?", params[:id]])
+ runner = Runner.find(:first, :conditions => ["id = ?", params[:id]])
if runner and Authorization.is_authorized?(action_name, nil, runner, current_user)
@runner = runner
Modified: branches/gianni-meandre/app/controllers/workflows_controller.rb (2525 => 2526)
--- branches/gianni-meandre/app/controllers/workflows_controller.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/controllers/workflows_controller.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -3,16 +3,19 @@
# Copyright (c) 2007 University of Manchester and the University of Southampton.
# See license.txt for details.
+require 'curb'
+require 'json'
+
class WorkflowsController < ApplicationController
before_filter :login_required, :except => [:index, :show, :download, :named_download, :statistics, :launch, :search]
before_filter :find_workflows_rss, : [:index]
- before_filter :find_workflow_auth, :except => [:search, :index, :new, :create]
+ before_filter :find_workflow_auth, :except => [:search, :index, :new, :create, :import, :get_available, :get_inputs]
- before_filter :initiliase_empty_objects_for_new_pages, : [:new, :create, :new_version, :create_version]
- before_filter :set_sharing_mode_variables, : [:show, :new, :create, :edit, :update]
+ before_filter :initiliase_empty_objects_for_new_pages, : [:new, :create, :new_version, :create_version, :import]
+ before_filter :set_sharing_mode_variables, : [:show, :new, :create, :edit, :update, :import]
- before_filter :check_file_size, : [:create, :create_version]
+ #before_filter :check_file_size, : [:create, :create_version]
before_filter :check_custom_workflow_type, : [:create, :create_version]
before_filter :check_is_owner, : [:edit, :update]
@@ -159,6 +162,14 @@
end
end
+ #GET /workflows/1/inputs
+ def get_inputs
+ workflow = Workflow.find_by_id(params[:id])
+ p = workflow.processor_class.new(workflow.content_blob.data)
+ input_ports = p.get_workflow_model_input_ports
+ render :partial=>"workflows/#{workflow.processor_class.name.demodulize.underscore}/inputs", :locals=>{:inputs=>input_ports}
+ end
+
# GET /workflows
def index
respond_to do |format|
@@ -213,6 +224,40 @@
def new
end
+ # GET /workflows/import
+ def import
+ @runners = Runner.find(:all, :conditions => {:details_type=>"MeandreInfrastructure"})
+ @workflows = get_workflows(@runners.first.id)
+ end
+
+ def get_workflows(runner_id)
+ #this method contacts a Meandre server and lists all the
+ #available workflows
+ #for use by the ajaxy bit of the import page
+ runner = Runner.find_by_id(runner_id)
+ c = Curl::Easy.new("#{runner.details.url}services/repository/list_flows.json")
+ c.userpwd = 'admin:admin'
+ begin
+ c.perform
+ @results = JSON.parse(c.body_str)
+ rescue
+ @results = []
+ end
+ end
+
+ # GET /workflows/get_available
+ def get_available
+ render :partial=>'workflows/get_available', :locals=>{:results=>get_workflows(params[:runner])}
+ end
+
+ def get_workflow_description(runner_id, workflow_uri)
+ runner = Runner.find(runner_id)
+ c = Curl::Easy.new("#{runner.details.url}services/repository/describe.ttl?uri=#{workflow_uri}")
+ c.userpwd = 'admin:admin'
+ c.perform
+ c.body_str
+ end
+
# GET /workflows/1/new_version
def new_version
end
@@ -227,15 +272,23 @@
# POST /workflows
def create
- file = params[:workflow][:file]
-
@workflow = Workflow.new
@workflow.contributor = current_user
@workflow.last_edited_by = current_user.id
@workflow.license_id = params[:workflow][:license_id] == "0" ? nil : params[:workflow][:license_id]
- @workflow.content_blob = ContentBlob.new(:data ="" file.read)
+
+ file = params[:workflow][:file]
+ if !file
+ file = Tempfile.new('workflow_import')
+ file.extend(FileUpload)
+ desc = get_workflow_description(params[:runner], params[:workflow_uri])
+ file.write(desc)
+ file.original_filename = 'hack.ttl'
+ @workflow.content_blob = ContentBlob.new(:data ="" desc)
+ else
+ @workflow.content_blob = ContentBlob.new(:data ="" file.read)
+ end
@workflow.file_ext = file.original_filename.split(".").last.downcase
-
file.rewind
# Check whether user has selected to infer metadata or provided custom metadata...
@@ -642,7 +695,7 @@
end
def initiliase_empty_objects_for_new_pages
- if ["new", "create"].include?(action_name)
+ if ["new", "create", "import"].include?(action_name)
@workflow = Workflow.new
end
@@ -672,7 +725,7 @@
def set_sharing_mode_variables
case action_name
- when "new"
+ when "new", "import"
@sharing_mode = 0
@updating_mode = 6
when "create", "update"
Modified: branches/gianni-meandre/app/helpers/jobs_helper.rb (2525 => 2526)
--- branches/gianni-meandre/app/helpers/jobs_helper.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/helpers/jobs_helper.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -70,5 +70,9 @@
file.close
return image_tag("/#{image_path}/#{image}")
end
+
+ def get_details_dir(job)
+ job.details_type.underscore
+ end
end
Modified: branches/gianni-meandre/app/helpers/runners_helper.rb (2525 => 2526)
--- branches/gianni-meandre/app/helpers/runners_helper.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/helpers/runners_helper.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -1,2 +1,5 @@
module RunnersHelper
+ def get_type_dir(c)
+ c.name.underscore
+ end
end
Modified: branches/gianni-meandre/app/models/blob.rb (2525 => 2526)
--- branches/gianni-meandre/app/models/blob.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/models/blob.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -67,4 +67,12 @@
def named_download_url
"#{Conf.base_uri}/files/#{id}/download/#{local_name}"
end
+
+ def handler
+ @handler ||= lambda do
+ handler_class = FileTypesHandler.for_mime_type(@blob.content_type.mime_type)
+ return nil if handler_class.nil?
+ handler_class.new(@blob.content_blob.data)
+ end
+ end
end
Modified: branches/gianni-meandre/app/models/job.rb (2525 => 2526)
--- branches/gianni-meandre/app/models/job.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/models/job.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -3,13 +3,18 @@
# Copyright (c) 2008 University of Manchester and the University of Southampton.
# See license.txt for details.
+require 'delayed_job'
+
class Job < ActiveRecord::Base
+ @details = nil
+ before_save :save_details
+
belongs_to :runnable, :polymorphic => true
validates_presence_of :runnable
validates_presence_of :runnable_version
- belongs_to :runner, :polymorphic => true
+ belongs_to :runner
validates_presence_of :runner
belongs_to :experiment
@@ -28,28 +33,6 @@
serialize :inputs_data
- def self.default_title(user)
- s = "Job_#{Time.now.strftime('%Y%m%d-%H%M')}"
- s = s + "_#{user.name}" if user
- return s
- end
-
- def last_status
- if self[:last_status].nil?
- return "not yet submitted"
- else
- return self[:last_status]
- end
- end
-
- def run_errors
- @run_errors ||= [ ]
- end
-
- def allow_run?
- self.job_uri.blank? and self.submitted_at.blank?
- end
-
def submit_and_run!
run_errors.clear
success = true
@@ -59,34 +42,19 @@
begin
# Only continue if runner service is valid
- unless runner.service_valid?
- run_errors << "The #{self.runner_type.humanize} is invalid or inaccessible. Please check the settings you have registered for this Runner."
+ unless runner.details.service_valid?
+ run_errors << "The #{runner.details_type.humanize} is invalid or inaccessible. Please check the settings you have registered for this Runner."
success = false
else
- # Ask the runner for the uri for the runnable object on the service
- # (should submit the object to the service if required)
- remote_runnable_uri = runner.get_remote_runnable_uri(self.runnable_type, self.runnable_id, self.runnable_version)
+ # Submit the job to the runner, which should begin to execute it, then get status
+ self.submitted_at = Time.now
+ self.job_uri = runner.details.submit_job(self)
+ self.save!
- if remote_runnable_uri
- # Submit inputs (if available) to runner service
- unless self.inputs_data.nil?
- self.inputs_uri = runner.submit_inputs(self.inputs_data)
- self.save!
- end
-
- # Submit the job to the runner, which should begin to execute it, then get status
- self.submitted_at = Time.now
- self.job_uri = runner.submit_job(remote_runnable_uri, self.inputs_uri)
- self.save!
-
- # Get status
- self.last_status = runner.get_job_status(self.job_uri)
- self.last_status_at = Time.now
- self.save!
- else
- run_errors << "Failed to submit the runnable item to the runner service. The item might not exist anymore or access may have been denied at the service."
- success = false
- end
+ # Get status
+ self.last_status = runner.details.get_job_status(self.job_uri)
+ self.last_status_at = Time.now
+ self.save!
end
rescue Exception => ex
@@ -104,27 +72,25 @@
return success
end
-
+
def refresh_status!
begin
if self.job_uri
- self.last_status = runner.get_job_status(self.job_uri)
+ self.last_status = runner.details.get_job_status(self.job_uri)
self.last_status_at = Time.now
unless self.started_at
- self.started_at = runner.get_job_started_at(self.job_uri)
+ self.started_at = runner.details.get_job_started_at(self.job_uri)
end
if self.finished?
unless self.completed_at
- self.completed_at = runner.get_job_completed_at(self.job_uri, self.last_status)
+ self.completed_at = runner.details.get_job_completed_at(self.job_uri, self.last_status)
end
end
if self.completed?
- unless self.outputs_uri
- self.outputs_uri = runner.get_job_outputs_uri(self.job_uri)
- end
+ details.update_outputs
end
self.save
@@ -135,106 +101,113 @@
return false
end
end
-
- def inputs_data=(data)
- if allow_run?
- self[:inputs_data] = data
- end
+
+ def self.default_title(user)
+ s = "Job_#{Time.now.strftime('%Y%m%d-%H%M')}"
+ s = s + "_#{user.name}" if user
+ return s
end
-
- def current_input_type(input_name)
- return 'none' if input_name.blank? or !self.inputs_data or self.inputs_data.empty?
-
- vals = self.inputs_data[input_name]
-
- return 'none' if vals.blank?
-
- if vals.is_a?(Array)
- return 'list'
- else
- return 'single'
- end
+
+ def details=(d)
+ @details = d
end
-
- def has_inputs?
- return self.inputs_data
+
+ def details
+ @details ||= Kernel.const_get(self.details_type).find_by_id(details_id)
end
- def report
- begin
- if self.job_uri
- return runner.get_job_report(self.job_uri)
- else
- return nil
- end
- rescue Exception => ex
- logger.error("ERROR occurred whilst fetching report for job #{self.job_uri}. Exception: #{ex}")
- logger.error(ex.backtrace)
- return nil
+ def last_status
+ if self[:last_status].nil?
+ return "not yet submitted"
+ else
+ return self[:last_status]
end
end
- def completed?
- return runner.verify_job_completed?(self.last_status)
+ def run_errors
+ @run_errors ||= [ ]
end
- def finished?
- return runner.verify_job_finished?(self.last_status)
+ def allow_run?
+ self.job_uri.blank? and self.submitted_at.blank?
end
- # Note: this will return outputs in a format as defined by the Runner.
- def outputs_data
+ def refresh_status!
begin
- if completed?
- return runner.get_job_outputs(self.job_uri)
- else
- return nil
- end
+ if self.job_uri
+ self.last_status = runner.details.get_job_status(self.job_uri)
+ self.last_status_at = Time.now
+
+ unless self.started_at
+ self.started_at = runner.details.get_job_started_at(self.job_uri)
+ end
+
+ if self.finished?
+ unless self.completed_at
+ self.completed_at = runner.details.get_job_completed_at(self.job_uri, self.last_status)
+ end
+ end
+
+ if self.completed?
+ unless self.outputs_uri
+ self.outputs_uri = runner.details.get_job_outputs_uri(self.job_uri)
+ end
+ end
+
+ self.save
+ end
rescue Exception => ex
- logger.error("ERROR occurred whilst fetching outputs for job #{self.job_uri}. Exception: #{ex}")
+ logger.error("ERROR occurred whilst refreshing status for job #{self.job_uri}. Exception: #{ex}")
logger.error(ex.backtrace)
- return nil
+ return false
end
end
- def outputs_as_xml
- begin
- if completed? and (xml_doc = runner.get_job_outputs_xml(self.job_uri))
- return xml_doc.to_s
- else
- return 'Error: could not retrieve outputs XML document.'
- end
- rescue Exception => ex
- logger.error("ERROR occurred whilst fetching outputs XML for job #{self.job_uri}. Exception: #{ex}")
- logger.error(ex.backtrace)
- return nil
+ def inputs_data=(data)
+ if allow_run?
+ self[:inputs_data] = data
end
end
- # Returns the size of the outputs in Bytes.
- def outputs_size
+ def report
begin
- if completed?
- return runner.get_job_output_size(self.job_uri)
+ if self.job_uri
+ return runner.details.get_job_report(self.job_uri)
else
return nil
end
rescue Exception => ex
- logger.error("ERROR occurred whilst getting outputs size for job #{self.job_uri}. Exception: #{ex}")
+ logger.error("ERROR occurred whilst fetching report for job #{self.job_uri}. Exception: #{ex}")
logger.error(ex.backtrace)
return nil
end
end
- def get_output_type(output_data)
- # Delegate out to the runner to handle it's own specific output format
- runner.get_output_type(output_data)
+ def completed?
+ return runner.details.verify_job_completed?(self.last_status)
end
- def get_output_mime_types(output_data)
- # Delegate out to the runner to handle it's own specific output format
- runner.get_output_mime_types(output_data)
+ def finished?
+ return runner.details.verify_job_finished?(self.last_status)
end
+
+ def save_details
+ self.details.save!
+ self.details_type = details.class.to_s
+ self.details_id = details.id
+ end
+
+ def perform
+ self.submit_and_run!
+ end
+
+ def queue
+ Delayed::Job.enqueue(self)
+ self.last_status = 'Queued'
+ self.last_status_at = Time.now
+ self.submitted_at = Time.now
+ self.save!
+ end
protected
Modified: branches/gianni-meandre/app/models/taverna_enactor.rb (2525 => 2526)
--- branches/gianni-meandre/app/models/taverna_enactor.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/models/taverna_enactor.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -12,39 +12,13 @@
acts_as_runner
- belongs_to :contributor, :polymorphic => true
- validates_presence_of :contributor
-
validates_presence_of :username
validates_presence_of :crypted_password
validates_presence_of :url
- validates_presence_of :title
encrypts :password, :mode => :symmetric, :key => Conf.sym_encryption_key
- def self.find_by_contributor(contributor_type, contributor_id)
- TavernaEnactor.find(:all, :conditions => ["contributor_type = ? AND contributor_id = ?", contributor_type, contributor_id])
- end
-
- def self.find_by_groups(user)
- return nil unless user.is_a?(User)
-
- runners = []
- user.all_networks.each do |n|
- runners = runners + TavernaEnactor.find_by_contributor('Network', n.id)
- end
-
- return runners
- end
-
- def self.for_user(user)
- return [ ] if user.nil? or !user.is_a?(User)
-
- # Return the runners that are owned by the user, and are owned by groups that the user is a part of.
- runners = TavernaEnactor.find_by_contributor('User', user.id)
- return runners + TavernaEnactor.find_by_groups(user)
- end
-
+
def service_valid?
service_client.service_valid?
end
@@ -89,8 +63,10 @@
service_client.upload_data(inputs_hash)
end
- def submit_job(remote_runnable_uri, inputs_uri)
- service_client.submit_job(remote_runnable_uri, inputs_uri)
+ def submit_job(job)
+ inputs_uri = submit_inputs(job.details.input_data)
+ remote_uri = get_remote_runnable_uri(job.runnable_type, job.runnable_id, job.runnable_version)
+ service_client.submit_job(remote_uri, inputs_uri)
end
def get_job_status(job_uri)
@@ -163,6 +139,16 @@
return 'unknown'
end
end
+
+ def update_details(details)
+ self.url = "" if details[:url]
+ self.username = details[:username] if details[:username]
+ self.password = details[:password] if details[:password]
+ end
+
+ def job_type
+ TavernaJob
+ end
protected
Modified: branches/gianni-meandre/app/models/workflow.rb (2525 => 2526)
--- branches/gianni-meandre/app/models/workflow.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/models/workflow.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -152,6 +152,7 @@
if proc_class
+ logger.debug('ANY DATA HERE? '+opts[:data])
processor = proc_class.new(opts[:data])
metadata["title"] = processor.get_title
@@ -303,4 +304,12 @@
true
end
end
+
+ def self.meandre_flows
+ workflows = []
+ Workflow.find(:all).each do |w|
+ workflows << w if w.processor_class == WorkflowProcessors::Meandre
+ end
+ workflows
+ end
end
Modified: branches/gianni-meandre/app/views/blobs/new.rhtml (2525 => 2526)
--- branches/gianni-meandre/app/views/blobs/new.rhtml 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/views/blobs/new.rhtml 2010-09-30 15:05:16 UTC (rev 2526)
@@ -3,6 +3,18 @@
<%= _javascript__include_tag :fckeditor %>
<%= _javascript__include_tag "osp.js" %>
+<script type="text/_javascript_">
+function toggleUploadField(){
+ if($('upload_type_file').checked){
+ Element.show('blob_data');
+ Element.hide('url');
+ }else{
+ Element.hide('blob_data');
+ Element.show('url');
+ }
+}
+</script>
+
<h1>Upload File</h1>
<%= error_messages_for :blob %>
@@ -11,7 +23,15 @@
<p style="text-align: center;">
<strong>File to upload: </strong>
+ <%=radio_button_tag 'upload_type', 'url'%>From URL
+ <%=radio_button_tag 'upload_type', 'file', true%>From File
+ <br/>
<%= file_field :blob, :data %>
+ <%= text_field_tag 'url', '', :style=>'display: none;'%>
+ <script type="text/_javascript_">
+ $('upload_type_url').observe('change', toggleUploadField)
+ $('upload_type_file').observe('change', toggleUploadField)
+ </script>
</p>
<br/>
Modified: branches/gianni-meandre/app/views/blobs/show.rhtml (2525 => 2526)
--- branches/gianni-meandre/app/views/blobs/show.rhtml 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/views/blobs/show.rhtml 2010-09-30 15:05:16 UTC (rev 2526)
@@ -93,6 +93,10 @@
You cannot download this File
</p>
<% end %>
+
+ <% unless @handler.nil? %>
+ <%=render :partial=>"blobs/address@hidden('/', '_')}/details" %>
+ <% end %>
</div>
</div>
Modified: branches/gianni-meandre/app/views/experiments/show.rhtml (2525 => 2526)
--- branches/gianni-meandre/app/views/experiments/show.rhtml 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/views/experiments/show.rhtml 2010-09-30 15:05:16 UTC (rev 2526)
@@ -56,6 +56,7 @@
<div class="tabContent">
<ul class="sectionIcons">
<li><%= icon('new', new_job_path(@experiment), nil, nil, 'New Job') %></li>
+ <li><%= icon('view-all', url_for(:action="" nil, nil, 'Run All') %></li>
</ul>
<% unless @experiment.jobs.empty? -%>
Deleted: branches/gianni-meandre/app/views/jobs/_status_info.rhtml (2525 => 2526)
--- branches/gianni-meandre/app/views/jobs/_status_info.rhtml 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/views/jobs/_status_info.rhtml 2010-09-30 15:05:16 UTC (rev 2526)
@@ -1,117 +0,0 @@
-<% if @stop_timer -%>
- <script>
- stop_timer = true;
- Element.remove('refresh_timer_text');
- </script>
-<% end %>
-
-<% if job -%>
-
- <% if job.allow_run? -%>
-
- <p style="text-align: center;"><b>This job has not been submitted yet.</b></p>
-
- <br/>
-
- <p class="note_text" style="text-align: center;">
- Remember to save any input data first, before submitting this job.
- </p>
-
- <p>
- <% form_tag submit_job_job_path(experiment, job) do -%>
- <center><%= submit_tag "Submit Job", :disable_with => "Submitting..." -%></center>
- <% end -%>
- </p>
-
- <% else -%>
-
- <% unless job.last_status.blank? -%>
- <p style="text-align: center;">
- Status:
- <font style="color: #990000; font-weight: bold;"><%= h job.last_status -%></font>,
- last checked at <%= datetime job.last_status_at -%>.
- </p>
- <% else -%>
- <p class="none_text" style="text-align: center;">
- Status not available
- </p>
- <% end -%>
-
- <div class="box_simple" style="margin: 1em 0 2em 0; font-size: 93%;">
- <p>
- Job submitted at
- <b><%= datetime job.submitted_at -%></b>
- </p>
- <p>
- Job started at
- <% unless job.started_at.blank? -%>
- <b><%= datetime job.started_at -%></b>
- <% else -%>
- <span class="none_text">unknown</span>
- <% end -%>
- </p>
- <p>
- Job completed at
- <% unless job.completed_at.blank? -%>
- <b><%= datetime job.completed_at -%></b>
- <% else -%>
- <span class="none_text">unknown</span>
- <% end -%>
- </p>
- <p>
- Job inputs URI:
- <% unless job.inputs_uri.blank? -%>
- <%= link_to job.inputs_uri, job.inputs_uri, :target => '_blank' -%>
- <% else -%>
- <span class="none_text">not available</span>
- <% end -%>
- </p>
- <p>
- Job outputs URI:
- <% unless job.outputs_uri.blank? -%>
- <%= link_to job.outputs_uri, job.outputs_uri, :target => '_blank' -%>
- <% else -%>
- <span class="none_text">not available</span>
- <% end -%>
- </p>
-
- <% # TODO: download Job Manifest %>
- </div>
-
- <h4>Progress Report</h4>
-
- <% if (report = job.report) -%>
- <table class="job_report">
- <tr>
- <th>Processor</th>
- <th>Status</th>
- <th>Detail</th>
- <th>Time</th>
- </tr>
-
- <% for processor in report.processors -%>
- <tr>
- <td><%= h processor.name -%></td>
- <td><%= h processor.status -%></td>
- <td>
- <% if processor.status == 'ITERATING' -%>
- <%= h processor.number -%> of <%= h processor.total -%>
- <% end %>
- </td>
- <td><%= h processor.time -%></td>
- </tr>
- <% end %>
- </table>
- <% else %>
- <p class="none_text">Report unavailable at this time</p>
- <% end %>
-
- <br/><br/>
-
- <ul class="sectionIcons">
- <li><%= icon('rerun', rerun_job_path(experiment, job), nil, { :confirm => 'Note: this will create a new Job with the settings and input data copied from this Job. Continue?', :method => :post }, 'Rerun Job') %></li>
- </ul>
-
- <% end -%>
-
-<% end -%>
\ No newline at end of file
Modified: branches/gianni-meandre/app/views/jobs/new.rhtml (2525 => 2526)
--- branches/gianni-meandre/app/views/jobs/new.rhtml 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/views/jobs/new.rhtml 2010-09-30 15:05:16 UTC (rev 2526)
@@ -74,7 +74,7 @@
<p>
<b>Runner to use: </b>
<%= form.select :runner_id,
- TavernaEnactor.for_user(current_user).collect {|r| [ r.title, r.id ]},
+ Runner.for_user(current_user).collect {|r| [ r.title, r.id ]},
{ :prompt => '--- Select Runner ---' },
{ :style => "vertical-align: middle;" } %>
<%= form.hidden_field :runner_type %>
Modified: branches/gianni-meandre/app/views/jobs/show.rhtml (2525 => 2526)
--- branches/gianni-meandre/app/views/jobs/show.rhtml 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/views/jobs/show.rhtml 2010-09-30 15:05:16 UTC (rev 2526)
@@ -141,102 +141,7 @@
<% inputs = @job.runnable.get_input_ports(@job.runnable_version) -%>
<% if @job.allow_run? -%>
<% if inputs and not inputs.empty? -%>
- <p class="note_text" style="text-align: center;">
- Remember to click 'save' when you are done with setting/editing the input data.
- </p>
-
- <br/>
-
- <% form_tag save_inputs_job_path(@experiment, @job), :multipart => true do -%>
- <% s_field_counter = 0 -%>
-
- <% inputs.each do |i| -%>
- <% input_type = @job.current_input_type(i.name) -%>
-
- <h4>Input Port: <%= i.name %></h4>
-
- <p class="box_standout" style="font-size: 93%; margin-bottom: 0.6em; padding: 0.2em 0.5em;">
- <b>Description: </b>
- <% unless i.description.blank? -%>
- <%= h i.description -%>
- <% else -%>
- <span class="none_text">none</span>
- <% end -%>
- </p>
-
- <div class="box_editing" style="padding-top: 0;">
- <table style="font-size: 93%; margin-bottom: 0.5em; margin-left: 0;">
- <tr>
- <td>
- <%= radio_button_tag "#{i.name}_input_type", 'none', (input_type == 'none'), : "_javascript_:update_inputs_states('#{escape_javascript i.name}', this.value);" -%>
- No input
- </td>
- <td>
- <%= radio_button_tag "#{i.name}_input_type", 'single', (input_type == 'single'), : "_javascript_:update_inputs_states('#{escape_javascript i.name}', this.value);" -%>
- Single input
- </td>
- <td>
- <%= radio_button_tag "#{i.name}_input_type", 'list', (input_type == 'list'), : "_javascript_:update_inputs_states('#{escape_javascript i.name}', this.value);" -%>
- List of inputs
- </td>
- <td>
- <%= radio_button_tag "#{i.name}_input_type", 'file', false, : "_javascript_:update_inputs_states('#{escape_javascript i.name}', this.value);" -%>
- From file
- </td>
- </tr>
- </table>
-
- <div id="<%= i.name -%>_single_input_box" class="box_editing_inner" style="display: none; width: 440px;">
- <center>
- <%= text_area_tag "#{i.name}_single_input",
- input_type == 'single' ? h(@job.inputs_data[i.name]) : nil,
- :size => "50x10" -%>
- </center>
- </div>
-
- <div id="<%= i.name -%>_list_input_box" class="box_editing_inner" style="display: none; width: 635px;">
- <div id="<%= i.name -%>_list" style="margin-bottom: 0.5em;">
- <%- if input_type == 'none' or @job.inputs_data[i.name].nil? %>
- <p><%= text_field_tag "#{i.name}_list_input[0]", nil, :size => 90 -%></p>
- <% else -%>
- <% @job.inputs_data[i.name].each do |val| -%>
- <% s_field_counter = s_field_counter + 1 -%>
- <% p_id = i.name + '_p_' + s_field_counter.to_s -%>
- <p id="<%= p_id %>">
- <%= text_field_tag "#{i.name}_list_input[#{s_field_counter}]", val, :size => 90 -%>
- <small>[<a href="" p_id %>'); return false;">delete</a>]</small>
- </p>
- <% end -%>
- <% end -%>
- </div>
- <p style="font-size: 93%; font-weight: bold;">
- <a href="" escape_javascript i.name -%>', '<%= escape_javascript i.name -%>_list'); return false;">Add another input</a>
- </p>
- </div>
-
- <div id="<%= i.name -%>_file_input_box" class="box_editing_inner" style="display: none; width: 500px;">
- <p style="font-size: 85%; color: #333333; padding-top: 0; text-align: center;">
- Note: this will create a single input for this port, with the contents of the file as the input data.
- </p>
- <center><%= file_field_tag "#{i.name}_file_input", :size => 60 -%></center>
- </div>
- </div>
-
- <script>update_inputs_states('<%= escape_javascript i.name -%>', '<%= input_type -%>')</script>
-
- <br/><br/>
- <% end -%>
-
- <script>field_counter = <%= s_field_counter -%></script>
-
- <p class="note_text" style="text-align: center;">
- Remember to click 'save' when you are done with setting/editing the input data.
- </p>
-
- <p>
- <center><%= submit_tag "Save Input Data", :disable_with => "Saving..." -%></center>
- </p>
- <% end %>
+ <%=render :partial=>"jobs/#{get_details_dir(@job)}/inputs", :locals=>{:inputs => inputs} %>
<% else -%>
<p class="none_text">No input ports found. Input values may be hard coded in.</p>
<% end -%>
@@ -246,28 +151,10 @@
This Job has already been submitted and therefore inputs cannot be changed now.
</p>
- <% if @job.inputs_data.nil? -%>
+ <% if @job.details.inputs_data.nil? -%>
<p class="none_text">No input data was provided.</p>
<% else -%>
- <% inputs.each do |i| -%>
- <% input_type = @job.current_input_type(i.name) -%>
- <div class="box_simple" style="margin-top: 0.5em;">
- <h4>Input Port: <%= i.name %></h4>
- <% if input_type == 'none' -%>
- <p>No input</p>
- <% elsif input_type == 'single' -%>
- <p>Single input:</p>
- <p style="margin-left: 1em;"><%= h @job.inputs_data[i.name] -%></p>
- <% elsif input_type == 'list' -%>
- <p>List of inputs:</p>
- <ul style="margin-top: 0;">
- <% @job.inputs_data[i.name].each do |val| -%>
- <li><%= h val -%></li>
- <% end -%>
- </ul>
- <% end %>
- </div>
- <% end -%>
+ <%=render :partial=>"jobs/#{get_details_dir(@job)}/inputs", :locals=>{:inputs => inputs} %>
<% end -%>
<% end -%>
@@ -314,7 +201,7 @@
<% end -%>
<div id="status_box">
- <%= render :partial => "status_info", :locals => { :job => @job, :experiment => @experiment } -%>
+ <%= render :partial => "jobs/#{get_details_dir(@job)}/status_info", :locals => { :job => @job, :experiment => @experiment } -%>
</div>
</div>
Modified: branches/gianni-meandre/app/views/runners/_table.rhtml (2525 => 2526)
--- branches/gianni-meandre/app/views/runners/_table.rhtml 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/views/runners/_table.rhtml 2010-09-30 15:05:16 UTC (rev 2526)
@@ -29,7 +29,7 @@
<% end %>
<p style="font-size: 85%;">
- <b>URL:</b> <%= h runner.url %>
+ <b>URL:</b> <%= h runner.details.url %>
</p>
</td>
Modified: branches/gianni-meandre/app/views/runners/edit.rhtml (2525 => 2526)
--- branches/gianni-meandre/app/views/runners/edit.rhtml 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/views/runners/edit.rhtml 2010-09-30 15:05:16 UTC (rev 2526)
@@ -5,54 +5,6 @@
<center>
<div class="box_form" style="width: 550px; margin: 1em 0; text-align: left;">
<p style="text-align: center; font-size: 85%;">Note: the runner will NOT be verified / validated on creation.</p>
-
- <% form_tag runner_path(@runner), :method => :put do -%>
- <p><b>Title</b></p>
- <%= text_field_tag "runner[title]", @runner.title, :size => 86 %>
-
- <p><b>Description</b></p>
- <%= text_area_tag "runner[description]", @runner.description, :size => "65x6" %>
-
- <p><b>URL</b></p>
- <%= text_field_tag "runner[url]", @runner.url, :size => 86 %>
-
- <br/><br/>
-
- <fieldset>
- <legend>Access Credentials</legend>
-
- <p><b>Username</b></p>
- <%= text_field_tag "runner[username]", @runner.username, :size => 30 %>
-
- <p><b>Password</b> (will be encrypted)</p>
- <%= text_field_tag "runner[password]", @runner.crypted_password.decrypt, :size => 30 %>
- </fieldset>
-
- <br/>
-
- <fieldset>
- <legend>Ownership</legend>
-
- <p style="font-size: 93%;">
- <b>By default, this Runner will be owned by you.</b>
- </p>
- <p style="font-size: 93%;">
- However, you can assign it to one of your Groups,
- which will allow members of that Group to use it in their Jobs.
- Note that only the admin of the Group can then change the URL and Access Credentials.
- </p>
-
- <p>
- <%= check_box_tag 'assign_to_group', "1", (@runner.contributor_type == 'Network'), :style => "vertical-align: middle;" -%>
- <span style="vertical-align: middle;">Assign to Group:</span>
- <%= select_tag "assign_to_group_id",
- options_from_collection_for_select(current_user.all_networks, "id", "title", (@runner.contributor_type == 'Network' ? @runner.contributor_id : nil)),
- :style => "vertical-align: middle;" -%>
- </p>
- </fieldset>
-
- <br/><br/>
- <center><%= submit_tag "Update", :disable_with => "Updating..." %></center>
- <% end -%>
+ <%=render :partial=>"runners/#{get_type_dir(@runner.details.class)}/edit"%>
</div>
</center>
Modified: branches/gianni-meandre/app/views/runners/new.rhtml (2525 => 2526)
--- branches/gianni-meandre/app/views/runners/new.rhtml 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/views/runners/new.rhtml 2010-09-30 15:05:16 UTC (rev 2526)
@@ -1,58 +1,32 @@
-<h1>New Taverna Enactor Runner</h1>
+<h1>New Runner</h1>
<%= error_messages_for :runner %>
+<% form_tag runners_path do -%>
<center>
<div class="box_form" style="width: 550px; margin: 1em 0; text-align: left;">
- <p style="text-align: center; font-size: 85%;">Note: the runner will NOT be verified / validated on creation.</p>
-
- <% form_tag runners_path do -%>
- <p><b>Title</b></p>
- <%= text_field_tag "runner[title]", nil, :size => 86 %>
-
- <p><b>Description</b></p>
- <%= text_area_tag "runner[description]", nil, :size => "65x6" %>
-
- <p><b>URL</b></p>
- <%= text_field_tag "runner[url]", nil, :size => 86 %>
-
- <br/><br/>
-
- <fieldset>
- <legend>Access Credentials</legend>
-
- <p><b>Username</b></p>
- <%= text_field_tag "runner[username]", nil, :size => 30 %>
-
- <p><b>Password</b> (will be encrypted)</p>
- <%= text_field_tag "runner[password]", nil, :size => 30 %>
- </fieldset>
-
- <br/>
-
- <fieldset>
- <legend>Ownership</legend>
-
- <p style="font-size: 93%;">
- <b>By default, this Runner will be owned by you.</b>
- </p>
- <p style="font-size: 93%;">
- However, you can assign it to one of your Groups,
- which will allow members of that Group to use it in their Jobs.
- Note that only the admin of the Group can then change the URL and Access Credentials.
- </p>
-
- <p>
- <%= check_box_tag('assign_to_group', "1", false, :style => "vertical-align: middle;") -%>
- <span style="vertical-align: middle;">Assign to Group:</span>
- <%= select_tag "assign_to_group_id",
- options_from_collection_for_select(current_user.all_networks, "id", "title"),
- :style => "vertical-align: middle;" -%>
- </p>
- </fieldset>
-
- <br/><br/>
- <center><%= submit_tag "Create", :disable_with => "Creating..." %></center>
- <% end -%>
+ <h2>Select Runner Type</h2>
+ <select id="runner_type" name="runner_type">
+ <% @runners.each do |runner| %>
+ <option value="<%=runner.name%>"><%=runner.name%></option>
+ <% end %>
+ </select>
</div>
</center>
+
+<% @runners.each do |runner| %>
+ <div style="display: none;" id="form_<%=runner.name%>" class="runner_form">
+ <%=render :partial=>"runners/#{get_type_dir(runner)}/new"%>
+ </div>
+<% end %>
+
+<% end -%>
+
+<script type="text/_javascript_">
+ function showForm(){
+ $$('.runner_form').each(Element.hide);
+ Effect.BlindDown('form_' + $('runner_type').value);
+ }
+ $('runner_type').addEventListener('change', showForm, false);
+ showForm();
+</script>
Modified: branches/gianni-meandre/app/views/runners/show.rhtml (2525 => 2526)
--- branches/gianni-meandre/app/views/runners/show.rhtml 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/app/views/runners/show.rhtml 2010-09-30 15:05:16 UTC (rev 2526)
@@ -19,32 +19,12 @@
<p><b>Owner:</b> <%= contributor(@runner.contributor_id, @runner.contributor_type) -%> (<%= visible_name @runner.contributor_type -%>)</p>
<p><b>Type:</b> <%= @runner.class.to_s -%></p>
-<p><b>URL (to Service):</b> <%= h @runner.url -%></p>
<p><b>Created:</b> <%= datetime @runner.created_at -%></p>
<p><b>Last Updated:</b> <%= datetime @runner.updated_at -%></p>
<br/><br/>
-<h2>Status</h2>
-<ul class="sectionIcons" style="margin-top: 1.5em; text-align: left;">
- <li style="margin-left: 0;">
- <%= link_to_remote "#{image_tag 'refresh.gif'} Verify Status",
- :url =""
- :method => :get,
- :update => 'status_box',
- :success => "new Effect.Highlight('status_box', { duration: 1.5 });",
- :loading => "Element.show('refresh_indicator')",
- :complete => "Element.hide('refresh_indicator')" -%>
-
- <%= image_tag "spinner.gif", :id => "refresh_indicator", :style => "display: none; margin-left: 1em;" -%>
- </li>
-</ul>
-
-<div id="status_box" style="margin-top: 1.5em; font-weight: bold; color: #990000;">
- <% render :partial => "status", :locals => { :service_valid => @runner.service_valid? } -%>
-</div>
-
<%= render :partial => "contributions/alternative_formats" %>
Modified: branches/gianni-meandre/config/default_settings.yml (2525 => 2526)
--- branches/gianni-meandre/config/default_settings.yml 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/config/default_settings.yml 2010-09-30 15:05:16 UTC (rev 2526)
@@ -215,17 +215,17 @@
- label: Runner
link: /runners/new
controller: runners
- condition: logged_in? && !TavernaEnactor.for_user(current_user).empty?
+ condition: logged_in? && !Runner.for_user(current_user).empty?
- label: Experiment
link: /experiments/new
controller: experiments
- condition: logged_in? && !TavernaEnactor.for_user(current_user).empty?
+ condition: logged_in? && !Runner.for_user(current_user).empty?
- label: Job
link: /jobs/new
controller: jobs
- condition: logged_in? && !TavernaEnactor.for_user(current_user).empty?
+ condition: logged_in? && !Runner.for_user(current_user).empty?
# search_categories - These are the search categories shown in the search bar
# just under the main tabs.
Modified: branches/gianni-meandre/config/routes.rb (2525 => 2526)
--- branches/gianni-meandre/config/routes.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/config/routes.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -45,6 +45,7 @@
map.resources :runners, :member => { :verify => :get }
# Experiments
+ map.connect 'experiments/:id/run_all', :action="" :controller=>'experiments'
map.resources :experiments do |e|
# Experiments have nested Jobs
e.resources :jobs,
@@ -94,6 +95,11 @@
end
+ # For importing Meandre workflows
+ map.connect 'workflows/import', :action="" :controller=>'workflows'
+ map.connect 'workflows/get_available', :action="" :controller=>'workflows'
+ map.connect 'workflows/get_inputs', :action="" :controller=>'workflows'
+
# workflows (downloadable)
map.resources :workflows,
:collection => { :search => :get },
@@ -136,6 +142,7 @@
:collection => { :search => :get },
:member => { :download => :get,
:statistics => :get,
+ :make_experiment => :post,
:favourite => :post,
:favourite_delete => :delete,
:rate => :post,
@@ -254,6 +261,7 @@
map.resources :licenses
map.resources :license_attributes
+
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id'
end
Modified: branches/gianni-meandre/db/migrate/043_create_taverna_enactors.rb (2525 => 2526)
--- branches/gianni-meandre/db/migrate/043_create_taverna_enactors.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/db/migrate/043_create_taverna_enactors.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -1,19 +1,9 @@
class CreateTavernaEnactors < ActiveRecord::Migration
def self.up
create_table :taverna_enactors do |t|
- t.column :title, :string
-
- t.column :description, :text
-
- t.column :contributor_id, :integer
- t.column :contributor_type, :string
-
t.column :url, :string
t.column :username, :string
t.column :crypted_password, :string
-
- t.column :created_at, :datetime
- t.column :updated_at, :datetime
end
end
Modified: branches/gianni-meandre/lib/acts_as_runner.rb (2525 => 2526)
--- branches/gianni-meandre/lib/acts_as_runner.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/lib/acts_as_runner.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -12,9 +12,6 @@
module ClassMethods
def acts_as_runner
- has_many :jobs,
- :as => :runner,
- :order => "updated_at DESC"
class_eval do
extend Jits::Acts::Runner::SingletonMethods
@@ -37,4 +34,4 @@
ActiveRecord::Base.class_eval do
include Jits::Acts::Runner
-end
+end
Modified: branches/gianni-meandre/lib/authorization.rb (2525 => 2526)
--- branches/gianni-meandre/lib/authorization.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/lib/authorization.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -479,7 +479,7 @@
action = ''
when 'edit', 'new', 'create', 'update', 'new_version', 'create_version', 'destroy_version', 'edit_version', 'update_version', 'new_item', 'create_item', 'edit_item', 'update_item', 'quick_add', 'resolve_link', 'process_tag_suggestions', 'process_extra_metadata'
action = ''
- when 'download', 'named_download', 'launch', 'submit_job', 'save_inputs', 'refresh_status', 'rerun', 'refresh_outputs', 'render_output', 'outputs_xml', 'outputs_package'
+ when 'download', 'named_download', 'launch', 'submit_job', 'save_inputs', 'refresh_status', 'rerun', 'refresh_outputs', 'render_output', 'outputs_xml', 'outputs_package', 'run_all'
action = ''
when 'destroy', 'delete', 'destroy_item'
action = ''
Modified: branches/gianni-meandre/lib/workflow_types_handler.rb (2525 => 2526)
--- branches/gianni-meandre/lib/workflow_types_handler.rb 2010-09-30 12:06:26 UTC (rev 2525)
+++ branches/gianni-meandre/lib/workflow_types_handler.rb 2010-09-30 15:05:16 UTC (rev 2526)
@@ -66,6 +66,7 @@
c.file_extensions_supported.include?(file_ext) &&
c.recognised?(file)
end
+ logger.debug("FOUND CLASS: "+proc_class.name);
return proc_class
end