我需要实现一个调度程序模拟器。 我有一个主要流程和一个子流程。主要从文件中读取作业列表,然后将其传递给作为调度程序的子项。
我希望调度程序使用execvp函数作为单独的文件运行。
我有问题将使用 ~/workspace/productswatcher ➜ rails s
/files/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/react_on_rails-5.2.0/lib/react_on_rails/version.rb:3: warning: already initialized constant ReactOnRails::VERSION
/home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/react_on_rails-5.2.0/lib/react_on_rails/version.rb:3: warning: previous definition of VERSION was here
DEPRECATION WARNING: ActionView::Template::Handlers::Erubis is deprecated and will be removed from Rails 5.2. Switch to ActionView::Template::Handlers::ERB::Erubi instead. (called from <module:Haml> at /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/haml-4.0.7/lib/haml/helpers/safe_erubis_template.rb:3)
=> Booting Puma
=> Rails 5.1.3 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Exiting
bin/rails:6: warning: already initialized constant APP_PATH
/files/alter/workspace/productswatcher/bin/rails:6: warning: previous definition of APP_PATH was here
The most common rails commands are:
generate Generate new code (short-cut alias: "g")
console Start the Rails console (short-cut alias: "c")
server Start the Rails server (short-cut alias: "s")
test Run tests except system tests (short-cut alias: "t")
test:system Run system tests
dbconsole Start a console for the database specified in config/database.yml
(short-cut alias: "db")
new Create a new Rails application. "rails new my_app" creates a
new application called MyApp in "./my_app"
All commands can be run with -h (or --help) for more information.
In addition to those commands, there are:
/files/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:18: warning: already initialized constant Rails::Command::HELP_MAPPINGS
/home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:18: warning: previous definition of HELP_MAPPINGS was here
/home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/actionpack-5.1.3/lib/action_dispatch/middleware/stack.rb:74:in `insert': can't modify frozen Array (RuntimeError)
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/actionpack-5.1.3/lib/action_dispatch/middleware/stack.rb:74:in `insert'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/dragonfly-1.0.12/lib/dragonfly/railtie.rb:7:in `block in <class:Railtie>'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/initializable.rb:30:in `instance_exec'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/initializable.rb:30:in `run'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/initializable.rb:59:in `block in run_initializers'
from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /files/alter/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/initializable.rb:58:in `run_initializers'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/application.rb:353:in `initialize!'
from /files/alter/workspace/productswatcher/config/environment.rb:5:in `<top (required)>'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `block in require'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:258:in `load_dependency'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/application.rb:329:in `require_environment!'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command/actions.rb:16:in `require_application_and_environment!'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/commands/rake/rake_command.rb:31:in `rake_tasks'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/commands/rake/rake_command.rb:40:in `formatted_rake_tasks'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/commands/rake/rake_command.rb:10:in `printing_commands'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:91:in `each'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:91:in `flat_map'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:91:in `block in sorted_groups'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/core_ext/hash/transform_values.rb:26:in `block in transform_values!'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/core_ext/hash/transform_values.rb:25:in `each'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/core_ext/hash/transform_values.rb:25:in `transform_values!'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:91:in `sorted_groups'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:84:in `print_commands'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/commands/help/help_command.rb:9:in `help'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command/base.rb:63:in `perform'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/command.rb:44:in `invoke'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/railties-5.1.3/lib/rails/commands.rb:16:in `<top (required)>'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `block in require'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:258:in `load_dependency'
from /home/alter/.rvm/gems/ruby-2.2.5@productwatcher/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
from bin/rails:8:in `<main>'
和{{1}}创建的数组从main传递给调度程序。我尝试使用管道,但我不知道它是否有效,因为当我将调度程序编码为单独的文件时,我不知道如何访问数组。我尝试对数组使用相同的名称,但显然在尝试编译时,表示数组未声明。
在这种情况下,管道是正确的解决方案还是可以将数组作为调用exec函数的参数传递?
我怎样才能宣布&#34;在一个单独的文件中编写调度程序时的数组?