|
Member
|
lebanoff-coj
-
9/15/2010 12:44:43 PM
Scheduled Task Configuration
There must be a list of functions that Kentico already has available so I can just create a new scheduled task and reference it. I am looking for a list such as:
Built-In Task Task name Task assembly name Task class name Content publishing Content.Publish CMS.WorkflowEngine CMS.WorkflowEngine.ContentPublisher Content synchronization Staging.Synchronization CMS.SyncService CMS.Staging.StagingWorker Delete old shopping carts Ecommerce.DeleteOldShoppingCarts CMS.Ecommerce CMS.Ecommerce.ShoppingCartCleaner Users delete non activated user UsersDeleteNonActivatedUser CMS.Scheduler CMS.Scheduler.DeleteNonActivatedUser Rebuild Search Index ? ? ? Optimize Search Index ? ? ? Delete Eventlog ? ? ? What other built in functions can I reference to create scheduled tasks before having to code my own? ? ? ?
|
|
|
Member
|
lebanoff-coj
-
9/15/2010 12:48:51 PM
RE:Scheduled Task Configuration
Kentico suggested:I consulted your requirement with our TL and there is no such a list of scheduled tasks. However, you can search the source code for the string "ITask", which is used to define a new scheduled task.
But I don't see the tasks and class names that are already setup as existing scheduled tasks.
|
|
|
Kentico Support
|
kentico_jurajo
-
9/20/2010 7:56:15 AM
RE:Scheduled Task Configuration
Hi,
I assume that you are looking for the rebuild smart search index, etc. tasks. They are under Scheduler assembly in Tasks folder, e.g.: SearchIndexOptimizer.cs.
Could you please specify what exactly are you looking for from the default scheduled tasks?
Best regards, Juraj Ondrus
|
|
|
Member
|
lebanoff-coj
-
9/20/2010 9:16:39 AM
RE:Scheduled Task Configuration
I am actually looking for a complete list of tasks that can be entered, (all built in functions). My immediate need is as you mentioned the rebuild smart search index.
Thanks.
|
|
|
Kentico Support
|
kentico_jurajo
-
9/22/2010 2:34:43 AM
RE:Scheduled Task Configuration
Hi, There is no such a list of tasks. You need to search for the ITask in the source code files. Moreover, there is no task for index rebuilding - you need to schedule custom code where you will execute the code which is called after the rebuild index button is clicked (\CMSModules\SmartSearch\Controls\UI\SearchIndex_General.ascx.cs - btnRebuild_Click). Best regards, Juraj Ondrus
|
|
|
Member
|
casey-catalysis
-
3/15/2011 3:52:59 PM
RE:Scheduled Task Configuration
Is there any way to access the two tasks shown in the documentation here: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_managing_search_indexes.htmI would assume that we should be able to use the ones shown in the documentation without having to write our own custom scheduled tasks. If not, is code readily available to set up these tasks with minimal effort?
|
|
|
Member
|
casey-catalysis
-
3/15/2011 3:55:06 PM
RE:Scheduled Task Configuration
|
|
|
Kentico Support
|
kentico_jurajo
-
3/15/2011 5:07:04 PM
RE:Scheduled Task Configuration
Hi, Those tasks are accesible only if you have the source code license. They are designed in the way as described in the documentation since rebuilding whole index is and operation which requires lots of resources and it can slow down your site and CMS significantly. If you want to rebuild whole index, you need to create custom scheduled task as described above. Best regards, Juraj Ondrus
|
|
|
Member
|
martinagency
-
5/10/2011 10:55:23 PM
RE:Scheduled Task Configuration
We are currently creating a custom scheduled task to run the smart search rebuild. Our scheduled task will run the following: SearchTaskInfoProvider.CreateTask(SearchTaskTypeEnum.Rebuild, sii.IndexType, null, sii.IndexName); How can we find the IndexType and IndexName of our Smart Search? It looks like the "Rebuild" Button calls the following code code. return SetUniGridCmd_ctl00_plcContent_indexListElem_UniGrid('rebuild', '152'); Is "152" the IndexName ?
|
|
|
Kentico Developer
|
kentico_ivanat
-
5/16/2011 2:23:40 AM
RE:Scheduled Task Configuration
Hi, you will need to create a SearchInfoObject using: // Get search index object from database by searchIndexID SearchIndexInfo sii = SearchIndexInfoProvider.GetSearchIndexInfo(1); or // Get index object from database by index code name SearchIndexInfo sii = SearchIndexInfoProvider.GetSearchIndexInfo("TestIndex"); IndexName and IndexType are properties of above infoObject. Appropriate IndexID you can find in CMS_SearchIndex table. Best regards, Ivana Tomanickova
|
|
|
Member
|
chardi-marouane-hotmail
-
5/22/2013 4:46:08 PM
RE:Scheduled Task Configuration
hi i have this error : Error: [ClasHelper.GetClass]: App_Code class cannot be loaded because the OnGetCustomClass handler is not initialized.
i am trying to create a new task. please help
|
|
|
Kentico Support
|
kentico_jurajo
-
5/23/2013 1:02:14 AM
RE:Scheduled Task Configuration
Hello,
Would it be possible to provide us with your custom task/class code and also the settings of the scheduled task in the user interface?
Best regards, Juraj Ondrus
|
|
|
Member
|
chardi-marouane-hotmail
-
5/23/2013 10:39:50 AM
RE:Scheduled Task Configuration
I am kind of new in kentico. App_Code > ClassLoader.cs : using System; using System.Collections.Generic; using System.Linq; using System.Web; using CMS.SettingsProvider;
namespace CMSApp.App_Code { [ClassLoader] public partial class CMSModuleLoader { private class ClassLoader : CMSLoaderAttribute { public override void Init() { ClassHelper.OnGetCustomClass += ClassHelper_OnGetCustomClass; }
private void ClassHelper_OnGetCustomClass(object sender, ClassEventArgs e) { if (e.Object == null) { switch (e.ClassName) { // Gets an instance of the CustomTask class. case "Custom.CustomTask": e.Object = new Custom.CustomTask(); break; } } }
} }
}
App_Code > CustomTask.cs :
using System; using System.Collections.Generic; using System.Linq; using System.Web; using CMS.EventLog; using CMS.Scheduler;
namespace Custom { public class CustomTask : ITask { /// <summary> /// Executes the task. /// </summary> /// <param name="ti">Info object representing the scheduled task</param> public string Execute(TaskInfo ti) { string detail = "Executed from '~/App_Code/CustomTask.cs'. Task data:" + ti.TaskData;
// Logs the execution of the task in the event log. EventLogProvider.LogInformation("CustomTask", "Execute", detail);
return null; }
} }using System; using System.Collections.Generic; using System.Linq; using System.Web; using CMS.EventLog; using CMS.Scheduler;
namespace Custom { public class CustomTask : ITask { /// <param name="ti">Info object representing the scheduled task</param> public string Execute(TaskInfo ti) { string detail = "Executed from '~/App_Code/CustomTask.cs'. Task data:" + ti.TaskData; EventLogProvider.LogInformation("CustomTask", "Execute", detail);
return null; } } } that is the only two classes i have, and in cms Scheduled Tasks : Task display name : MyTask Task assembly name: : App_Code Task class name: Custom.CustomTask.cs
in Last result Column it shows : Error: [ClasHelper.GetClass]: App_Code class cannot be loaded because the OnGetCustomClass handler is not initialized. also would you please help me to create a simple task to test this code, maybe because i didn't do any task yet i don t know how and where. Thank you
|
|
|
Kentico Support
|
kentico_jurajo
-
5/23/2013 10:22:22 PM
RE:Scheduled Task Configuration
Hi, In the task class name there should not be the file name - so, no extension. Also, just to be sure, could you please confirm you have followed the scheduling custom code documentation? Which version of Kentico do you use? (This is v5 forum) This article describes how to register custom class in App_Code in Kentico 7 in general. Best regards, Juraj Ondrus
|
|
|
Member
|
chardi-marouane-hotmail
-
5/24/2013 12:58:29 PM
RE:Scheduled Task Configuration
yes, i did follow the exact step. kentico v7
basically, i need to create a custom scheduled Task that send an email containing all what happen in the log events every 24h.
would you help me please to create this Task. I would really really appreciate that.
|
|
|
Kentico Support
|
kentico_jurajo
-
5/26/2013 1:46:02 AM
RE:Scheduled Task Configuration
Hi,
Would it be possible to send to our support your class code files? I have done exactly the same and it is working fine for me. I would check the task registration in the Site Manager for any typos - this is common mistake and hard to track. I would also try re-creating the task again - restarting Visual studio and then create the class files from scratch.
Best regards, Juraj Ondrus
|
|
|
Member
|
chardi-marouane-hotmail
-
5/27/2013 7:59:39 PM
RE:Scheduled Task Configuration
all what i did for now is following the step by step of creating a custom scheduled Task, I added a class : CustomTask , and aother ClassLoader to App_code.
and then in task registration in the Site Manager : Task display name : MyTask Task assembly name: : App_Code Task class name: Custom.CustomTask
And i get this error : Error: [ClasHelper.GetClass]: App_Code class cannot be loaded because the OnGetCustomClass handler is not initialized.
and i have to put some code in the CustomTask that get all events in the event log and export them to Excel and send the Excel file by e-mail. can you please give me a sample code of coding this Task. I would really appreciate it.
|
|
|
Member
|
chardi-marouane-hotmail
-
5/29/2013 6:02:49 PM
RE:Scheduled Task Configuration
ClassLoader.cs : namespace CMSApp.App_Code { [ClassLoader] public partial class CMSModuleLoader { /// <summary> /// Attribute class for loading custom classes. /// </summary> private class ClassLoader : CMSLoaderAttribute { /// <summary> /// Called automatically when the application starts. /// </summary> public override void Init() { // Assigns a handler for the OnGetCustomClass event. ClassHelper.OnGetCustomClass += ClassHelper_OnGetCustomClass; }
/// <summary> /// Gets a custom class object based on the given parameters. /// </summary> private void ClassHelper_OnGetCustomClass(object sender, ClassEventArgs e) { if (e.Object == null) { // Checks the name of the requested class. switch (e.ClassName) { // Gets an instance of the CustomTask class. case "Custom.CustomTask": e.Object = new Custom.CustomTask(); break; } } } } } }
CustomTask.cs :
namespace Custom { public class CustomTask : ITask { public string Execute(TaskInfo ti) { string detail = "Executed from '~/App_Code/CustomTask.cs'. Task data:" + ti.TaskData;
// Logs the execution of the task in the event log. EventLogProvider.LogInformation("CustomTask", "Execute", detail);
return null; }
} } in the Site Manager : Task display name : MyTask Task assembly name: : App_Code Task class name: Custom.CustomTask it's exactly the same step by step in the article Scheduling custom code. why then my task is not executed and i get this error : Error: [ClasHelper.GetClass]: App_Code class cannot be loaded because the OnGetCustomClass handler is not initialized Why my class is not Loaded from App_Code. Any Ideas ????
|
|
|
Kentico Support
|
kentico_jurajo
-
5/30/2013 1:52:46 AM
RE:Scheduled Task Configuration
Hi,
Have you tried removing the namespace CMSApp.App_Code? It is working fine for me without it.
Also, have you tried putting the code to either \App_Code\Samples\Modules\SampleHandlerModule.cs or \App_Code\CMS\CMSModuleLoader.cs file?
Best regards, Juraj Ondrus
|
|
|
Member
|
chardi-marouane-hotmail
-
5/30/2013 3:04:39 PM
RE:Scheduled Task Configuration
I tried them and still load class from app_code.
My App_Code folder is empty, there is only the two classes i created ClassLoader.cs and CustomTask.cs.
I don t understand the difference between App_Code and Old_App_Code.
I don t have this \App_Code\Samples\Modules\SampleHandlerModule.cs , but i do have it in \Old_App_Code\Samples\Modules\SampleHandlerModule.cs.
is app_code the same as old_app_code ?
I have a few folders in old_app_code as : Application, CMS, CMSModules, Samples .
I tried to put the classes for customTask and ClassLoader in old_app_code but on site manager scheduled task it doesn't recognize the assembly : Old_App_code.
Thank you for your help.
|
|
|
Member
|
chardi-marouane-hotmail
-
5/30/2013 3:06:41 PM
RE:Scheduled Task Configuration
i mean still can't Load CustomTask from App_Code and still get the error : Error: [ClasHelper.GetClass]: App_Code class cannot be loaded because the OnGetCustomClass handler is not initialized.
|
|
|
Kentico Support
|
kentico_jurajo
-
5/31/2013 12:43:08 AM
RE:Scheduled Task Configuration
Hi,
This seems to be pretty important - are you using web site project or web application? It seems you are using web application. I assume that the class file is included into the application project. Have you tried rebuilding the application project as well?
Best regards, Juraj Ondrus
|
|
|
Member
|
chardi-marouane-hotmail
-
5/31/2013 12:25:19 PM
RE:Scheduled Task Configuration
yes i did rebuilt the application. still nothing.
how can i make it work in the Old_App_Code, Loading classes from Old_App_Code instead App_Code.
Thanks.
|
|
|
Kentico Support
|
kentico_jurajo
-
6/3/2013 5:13:42 AM
RE:Scheduled Task Configuration
Hello,
It is working just fine for me in both cases, just following the guide. One more idea - if you add a custom class in a web application, you need to build/re-build the whole web application project - have you done this already?
Best regards, Juraj Ondrus
|
|