K8s job management service, customized for MOOP API Server.
During deployment, please build image with dockerfiles in the project root.
Record image tag for further api requests.
Please place config.yaml under the root of job service.
config.yaml:
debug: true
# whether the service is running in a k8s cluster
in_cluster: false
# 10 - debug
log_level: 10
default_image: 'registry.mooplab.com:8443/tools/moop-tools:v1.0.0'
job_namespace: 'playfield'
pending_timeout: 60
pending_interval: 1
Place celery_config.py under the root of job service.
celery_config.py:
broker_url = 'redis://:[email protected]:6379/0'
result_backend = 'redis://:[email protected]:6379/0'
celery -A job-service worker -n job-service-dev
ps -ef | grep job-service | grep -v grep | awk '{print $2}' | xargs kill -9
celery task:
exec(cmd, image, vols)
parameters:
cmd = String
image = String
vols = [
{
"type": Number, # 0 - pvc, 1 - configmap
"name": String, # pvc or configmap name
"mount": String, # mount point
"subpath": String # mount sub path
}
]
return:
True # job successed
False # job failed or error