running ctakes with the AggregatePlaintextProcessor - ctakes

I want to run ctakes with the AggregatePlaintextProcessor or something that doesn't require a connection for UMLS. Help!


How to detect whether rspec tests were run in local or in Continuous Integration server ?

The title basically says it all - I would like to detect whether the tests are being run on local machine or in CI?
(so I could re-run the test in case it fails for some reason in the CI.)
I would try to figure out the host that is currently running the specs:
require 'socket'
And base my decision on this.

Rufus Scheduler not running

I want to do something simple with the gem rufus-scheduler:
but, i can't get it to work.
I have a regular rails app. I created a .rb file:
# test_rufus_scheduler.rb
require 'rubygems'
require 'rufus/scheduler'
scheduler = Rufus::Scheduler.start_new '1s' do
puts "hello world"
Then, when I try ruby test_rufus_scheduler.rb, nothing happens. Am i doing it right? gem list shows rufus-scheduler.
If your script exits right away please try to add
at the end. Please note that it's different when running the script stand alone and via rails. See the README for detailled information.
Add the below lines to your apache2 config and restart your apache2 server
RailsAppSpawnerIdleTime 0
PassengerMinInstances 1
Found a solution to this here (which also is in sync to Ajet's answer above).
Production servers require a bit of additional setup. On most production web servers, idle Ruby processes are killed. In order for Rufus to work, you'll need to stop this from happening. For Passenger/Nginx you can copy the following code below to your nginx.conf config file for your website after the line that says passenger_enabled on;.
passenger_spawn_method direct;
passenger_min_instances 1;
passenger_pool_idle_time 0;

ThinkingSphinx using RSpec, error: “Failed to start searchd daemon.”

I have a problem with running Sphinx in test
As that was shown in the example
I start the test with ThinkingSphinx::Test.start and end with ThinkingSphinx::Test.stop
The head section of test file contains
require 'thinking_sphinx/test'
The error is
Failed to start searchd daemon. Check ...searchd.log.
Do you familiar with this?
Are you running Sphinx already in development? And if so, do you have a different port setting for the test environment in config/sphinx.yml? If not, then you'll need to do that, to ensure you can have two daemons running at once.
I was getting the same issue. My tmp folder was missing. It solved once i made it.

Error in Resque

To implement resque in application, I am following the this example. I have done only one change, to not take 'idea' variable value from user input. I have given bydefault value for this variable. This code ruby files are in RAILS_ROOT/lib/ folder.
Whenever I run the program with command ruby idea_analyzer.rb, I see
[root#xxxxxx lib]# ruby idea_analyzer.rb
Analyzing your idea: I will learn ruby
Asking for a job to analyze: I
Asking for a job to analyze: will
Asking for a job to analyze: learn
Asking for a job to analyze: ruby
And when I run resque-web command on the console, and see sinatra app screen in the browser, I see job in failed queue with error 'uninitialized constant WordAnalyzer'
I have rake running: rake resque:work QUEUE=*
My redis-server is running. It shows continous logs like
2 clients connected (0 slaves), 471575 bytes in use, 0 shared objects
Can anyone tell me on this error?
Thanks in advance.
You might want to read it more carefully:
*If you see an error like no such file to load -- resque, then you need to add require "rubygems" at the top of your program. You should eventually see the error about a missing WordAnalyzer. I’ll take care of that next by creating a word_analyzer.rb file, defining the class…*

How do I start the sphinx daemon automatically when my rails application loads?

I am aware of the command to start the sphinx daemon manually. I use a rake task: "rake thinking_sphinx:start" Is it possible to have it start whenever my rails application loads so I don't have to manually type in the command every time?
You can configure daemon_controller to do this:
If you are deploying via capistrano (and you should be), simply add it as an after_deploy:
desc "Run this after every successful deployment"
task :after_deploy, :roles => :app do
run "#{current_path}/rake thinking_sphinx:start"
You should be able to test if it's running and launch it from within rails (using back-ticks or the %x{...} notation.
Given that (as you said in the comments) it's a rake task you may want to do it like so instead of with back-ticks:
Put the command to launch it in your config/initializers/custom.rb
I've had to do the same thing in my app, but with windows. In case you're in the same sticky mess, you'll find that your life will be much easier if you do something like:
if app_not_already_running
IO.popen("start app") do |fd|
I'm looking at old code and I don't remember if the do |fd| was really necessary. Give it a shot.
The reason the 'start' is important is to con windows into backgrounding the cursed thing. Yargh!
As mentioned above, create a file in config/initializers. For example, I created a file called initializers/start_thinking_sphinx.rb. And in the file I put
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
require "#{RAILS_ROOT}/vendor/plugins/thinking-sphinx/tasks/thinking_sphinx_tasks"
This works if I then start the server with script/server. However does not work if I start with passenger :(
Although this post is quite old, I add my solution just for the sake of completeness ...
I start the sphinx daemon without using rake, by putting the following code to config/initializers/launch_sphinx.rb.
Kernel.system("/usr/local/sphinx/bin/searchd --pidfile --config [full-path-to-your-app]/config/#{RAILS_ENV}.sphinx.config")
Change the paths to searchd and your rails application to your needs.