41 if (!$DIC->settings()->get(
'soap_user_administration')) {
42 $DIC->logger()->bgtk()->warning(
"SOAP not enabled, fallback to sync version");
44 $sync_manager->run($bucket);
50 $DIC->backgroundTasks()->persistence()->saveBucketAndItsTasks($bucket);
52 $DIC->logger()->bgtk()->info(
"Trying to call webserver");
55 $soap_client = new \ilSoapClient();
56 $soap_client->setResponseTimeout(0);
57 $soap_client->enableWSDL(
true);
59 $session_id = session_id();
60 $client_id = $DIC->http()->wrapper()->cookie()->retrieve(
62 $DIC->refinery()->byTrying([
63 $DIC->refinery()->kindlyTo()->string(),
64 $DIC->refinery()->always(
71 $soap_client->call(self::CMD_START_WORKER, array(
75 $DIC->logger()->bgtk()->warning($t->getMessage());
76 $DIC->logger()->bgtk()->warning(
"Calling webserver failed, fallback to sync version");
78 $sync_manager->run($bucket);
81 $DIC->logger()->bgtk()->info(
"Calling webserver successful");
91 $n_of_tasks = $ilIliasIniFile->readVariable(
"background_tasks",
"number_of_concurrent_tasks");
92 $n_of_tasks = $n_of_tasks ? $n_of_tasks : 5;
94 $DIC->logger()->bgtk()->info(
"Starting background job.");
98 $MAX_PARALLEL_JOBS = $n_of_tasks;
100 $DIC->logger()->bgtk()->info(
"Too many running jobs, worker going down.");
107 if (count($ids) === 0) {
113 $task = $bucket->getTask();
118 $this->persistence->updateBucket($bucket);
121 $this->persistence->deleteBucket($bucket);
124 $this->persistence->saveBucketAndItsTasks($bucket);
127 $DIC->logger()->bgtk()->info(
"Exception while async computing: " 129 $DIC->logger()->bgtk()->info(
"Stack Trace: " 130 . $e->getTraceAsString());
134 $DIC->logger()->bgtk()->info(
"One worker going down because there's nothing left to do.");
executeTask(Task $task, Observer $observer)
Actually executes a task.
loadBucket(int $bucket_container_id)
Class PersistingObserver.
setCurrentTask(Task $task)
getBucketIdsByState(int $state)
deleteBucket(Bucket $bucket)
Delete the bucket and all its stuff.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
run(Bucket $bucket)
This will add an Observer of the Task and start running the task.