【发布时间】:2014-06-18 03:52:25
【问题描述】:
我在我的 symfony(2.4) 项目中实现了Mmoreram gearman bundle 。
我有一个网站,用户可以采取行动并触发工作。
喜欢:
# Get Gearman and tell it to run in the background a 'job'
$id = $this->params['gearman']->doHighBackgroundJob('MYBundleServicesPublishWorker~publish',
json_encode($parameters)
);
我有一名工人可以无限运行并完成工作(迭代:0)
我在后台从命令行运行一次:
nohup php /myproject/app/console gearman:worker:execute MYBundleServicesPublishWorker > /tmp/error_log.txt > /tmp/output_log.txt &
配置如下:
gearman:
# Bundles will parsed searching workers
bundles:
# Name of bundle
MyBundle:
# Bundle name
name: myBundle
# Bundle search can be enabled or disabled
active: true
# If any include is defined, Only these namespaces will be parsed
# Otherwise, full Bundle will be parsed
include:
- Services
- EventListener
# Namespaces this Bundle will ignore when parsing
ignore:
- DependencyInjection
- Resources
# default values
# All these values will be used if are not overwritten in Workers or jobs
defaults:
# Default method related with all jobs
# do // deprecated as of pecl/gearman 1.0.0. Use doNormal
# doNormal
# doBackground
# doHigh
# doHighBackground
# doLow
# doLowBackground
method: doNormal
# Default number of executions before job dies.
# If annotations defined, will be overwritten
# If empty, 0 is defined by default
iterations: 0
# execute callbacks after operations using Kernel events
callbacks: true
# Prefix in all jobs
# If empty name will not be modified
# Useful for rename jobs in different environments
job_prefix: null
# Autogenerate unique key in jobs/tasks if not set
# This key is unique given a Job name and a payload serialized
generate_unique_key: true
# Prepend namespace when callableName is built
# By default this variable is set as true
workers_name_prepend_namespace: true
# Server list where workers and clients will connect to
# Each server must contain host and port
# If annotations defined, will be full overwritten
#
# If servers empty, simple localhost server is defined by default
# If port empty, 4730 is defined by efault
servers:
localhost:
host: 127.0.0.1
port: 4730
doctrine_cache:
providers:
gearman_cache:
type: apc
namespace: doctrine_cache.ns.gearman
我的问题是,当我运行 app/console cache:clear 之后,工作人员崩溃了
它的抛出错误:
PHP 警告: 需要一次(/myproject/app/cache/dev/jms_diextra/doctrine/EntityManager_53a06fbf221b4.php): 无法打开流:中没有这样的文件或目录 /myproject/app/cache/dev/appDevDebugProjectContainer.php 在第 787 行
PHP 致命错误:require_once():需要打开失败 '/myproject/app/cache/dev/jms_diextra/doctrine/EntityManager_53a06fbf221b4.php' (include_path='.:/usr/share/php:/usr/share/pear') 在 /myproject/app/cache/dev/appDevDebugProjectContainer.php 在第 787 行
如何修复它,我尝试更改学说包缓存类型:file_system/array/apc 但它没有帮助
我该如何克服呢? 我做错了什么?
提前致谢
【问题讨论】:
标签: php symfony doctrine-orm backgroundworker gearman