Skip to content
Snippets Groups Projects
Commit a5cd92d9 authored by bfs15's avatar bfs15
Browse files

Added error checking on infomap call

parent 6505ee68
No related branches found
No related tags found
No related merge requests found
...@@ -21,13 +21,12 @@ namespace :tag do ...@@ -21,13 +21,12 @@ namespace :tag do
desc 'Generate tag clusters' desc 'Generate tag clusters'
task :generate_clusters => [:environment] do task :generate_clusters => [:environment] do
# DEBUG = true # DEBUG = true
graph_path = TagSearchService.file_path+".net" graph_path = TagSearchService.file_path+".net"
hash = create_hash() hash = create_hash()
create_pajek_net_graph(hash, graph_path) create_pajek_net_graph(hash, graph_path)
# puts "\nCalling infomap with the pajek graph\n\n" if DEBUG infomap_ftree(graph_path, TagSearchService.root_dir)
system("infomap --ftree #{graph_path} #{TagSearchService.root_dir}")
Rails.cache.delete(TagSearchService::CACHE_KEY) Rails.cache.delete(TagSearchService::CACHE_KEY)
end # task end # task
...@@ -96,4 +95,14 @@ namespace :tag do ...@@ -96,4 +95,14 @@ namespace :tag do
end end
end end
end end
def infomap_ftree(graph_path, out_dir)
# puts "\nCalling infomap with the pajek graph\n\n" if DEBUG
system("infomap --ftree #{graph_path} #{TagSearchService.root_dir}")
if $?.to_s != "0"
puts "-- Error on Infomap call"
puts "-- Make sure you have infomap in your executable path"
exit
end
end
end # namespace end # namespace
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment