feat: introduce trigger functionality (#27644)

Signed-off-by: lyzno1 <yuanyouhuilyz@gmail.com>
Co-authored-by: Stream <Stream_2@qq.com>
Co-authored-by: lyzno1 <92089059+lyzno1@users.noreply.github.com>
Co-authored-by: zhsama <torvalds@linux.do>
Co-authored-by: Harry <xh001x@hotmail.com>
Co-authored-by: lyzno1 <yuanyouhuilyz@gmail.com>
Co-authored-by: yessenia <yessenia.contact@gmail.com>
Co-authored-by: hjlarry <hjlarry@163.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: WTW0313 <twwu@dify.ai>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Yeuoly
2025-11-12 17:59:37 +08:00
committed by GitHub
parent ca7794305b
commit b76e17b25d
785 changed files with 41186 additions and 3725 deletions

60
dev/start-beat Executable file
View File

@ -0,0 +1,60 @@
#!/bin/bash
set -x
# Help function
show_help() {
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " --loglevel LEVEL Log level (default: INFO)"
echo " --scheduler SCHEDULER Scheduler class (default: celery.beat:PersistentScheduler)"
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
echo " $0"
echo " $0 --loglevel DEBUG"
echo " $0 --scheduler django_celery_beat.schedulers:DatabaseScheduler"
echo ""
echo "Description:"
echo " Starts Celery Beat scheduler for periodic task execution."
echo " Beat sends scheduled tasks to worker queues at specified intervals."
}
# Parse command line arguments
LOGLEVEL="INFO"
SCHEDULER="celery.beat:PersistentScheduler"
while [[ $# -gt 0 ]]; do
case $1 in
--loglevel)
LOGLEVEL="$2"
shift 2
;;
--scheduler)
SCHEDULER="$2"
shift 2
;;
-h|--help)
show_help
exit 0
;;
*)
echo "Unknown option: $1"
show_help
exit 1
;;
esac
done
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
cd "$SCRIPT_DIR/.."
echo "Starting Celery Beat with:"
echo " Log Level: ${LOGLEVEL}"
echo " Scheduler: ${SCHEDULER}"
uv --directory api run \
celery -A app.celery beat \
--loglevel ${LOGLEVEL} \
--scheduler ${SCHEDULER}

8
dev/start-web Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
set -x
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
cd "$SCRIPT_DIR/../web"
pnpm install && pnpm build && pnpm start

View File

@ -2,9 +2,106 @@
set -x
# Help function
show_help() {
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " -q, --queues QUEUES Comma-separated list of queues to process"
echo " -c, --concurrency NUM Number of worker processes (default: 1)"
echo " -P, --pool POOL Pool implementation (default: gevent)"
echo " --loglevel LEVEL Log level (default: INFO)"
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
echo " $0 --queues dataset,workflow"
echo " $0 --queues workflow_professional,workflow_team --concurrency 4"
echo " $0 --queues dataset --concurrency 2 --pool prefork"
echo ""
echo "Available queues:"
echo " dataset - RAG indexing and document processing"
echo " workflow - Workflow triggers (community edition)"
echo " workflow_professional - Professional tier workflows (cloud edition)"
echo " workflow_team - Team tier workflows (cloud edition)"
echo " workflow_sandbox - Sandbox tier workflows (cloud edition)"
echo " schedule_poller - Schedule polling tasks"
echo " schedule_executor - Schedule execution tasks"
echo " mail - Email notifications"
echo " ops_trace - Operations tracing"
echo " app_deletion - Application cleanup"
echo " plugin - Plugin operations"
echo " workflow_storage - Workflow storage tasks"
echo " conversation - Conversation tasks"
echo " priority_pipeline - High priority pipeline tasks"
echo " pipeline - Standard pipeline tasks"
echo " triggered_workflow_dispatcher - Trigger dispatcher tasks"
echo " trigger_refresh_executor - Trigger refresh tasks"
}
# Parse command line arguments
QUEUES=""
CONCURRENCY=1
POOL="gevent"
LOGLEVEL="INFO"
while [[ $# -gt 0 ]]; do
case $1 in
-q|--queues)
QUEUES="$2"
shift 2
;;
-c|--concurrency)
CONCURRENCY="$2"
shift 2
;;
-P|--pool)
POOL="$2"
shift 2
;;
--loglevel)
LOGLEVEL="$2"
shift 2
;;
-h|--help)
show_help
exit 0
;;
*)
echo "Unknown option: $1"
show_help
exit 1
;;
esac
done
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
cd "$SCRIPT_DIR/.."
# If no queues specified, use edition-based defaults
if [[ -z "${QUEUES}" ]]; then
# Get EDITION from environment, default to SELF_HOSTED (community edition)
EDITION=${EDITION:-"SELF_HOSTED"}
# Configure queues based on edition
if [[ "${EDITION}" == "CLOUD" ]]; then
# Cloud edition: separate queues for dataset and trigger tasks
QUEUES="dataset,priority_dataset,priority_pipeline,pipeline,mail,ops_trace,app_deletion,plugin,workflow_storage,conversation,workflow_professional,workflow_team,workflow_sandbox,schedule_poller,schedule_executor,triggered_workflow_dispatcher,trigger_refresh_executor"
else
# Community edition (SELF_HOSTED): dataset and workflow have separate queues
QUEUES="dataset,priority_dataset,priority_pipeline,pipeline,mail,ops_trace,app_deletion,plugin,workflow_storage,conversation,workflow,schedule_poller,schedule_executor,triggered_workflow_dispatcher,trigger_refresh_executor"
fi
echo "No queues specified, using edition-based defaults: ${QUEUES}"
else
echo "Using specified queues: ${QUEUES}"
fi
echo "Starting Celery worker with:"
echo " Queues: ${QUEUES}"
echo " Concurrency: ${CONCURRENCY}"
echo " Pool: ${POOL}"
echo " Log Level: ${LOGLEVEL}"
uv --directory api run \
celery -A app.celery worker \
-P gevent -c 1 --loglevel INFO -Q dataset,priority_dataset,generation,mail,ops_trace,app_deletion,plugin,workflow_storage,conversation,priority_pipeline,pipeline
celery -A app.celery worker \
-P ${POOL} -c ${CONCURRENCY} --loglevel ${LOGLEVEL} -Q ${QUEUES}