How to move defined tasks from one Instance of Cache to another
I am working with a client to try and export a set of tasks defined in the Task Manager from one system to another. I am not seeing any API for this. I can query this information in SQL. So I tried to use the Data Export Wizard from the System Management portal in the SQL window. Export was fine. Importing failed with a "can't insert into read only field" error. Looking at the class definition does not help since the implementation details are not visible.
So how would one accomplish this? Export scheduled tasks from one system to another?
Hi Rich,
I've not used it, but perhaps take a look at the export tasks and import tasks on the %SYS.Task class...
https://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25SYS.Task
Sean
Looks to be there in 2017.1 as well...
http://docs.intersystems.com/cache20171/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25SYS.Task
I see this in the latest version of the online docs which is version 2017.2. obviously something was amiss in the build I was using.
I have tried this, but the import does not work. I get an error that only states nothing was imported. Not terribly helpful .
That's the doc for the %SYS.Task package. One row above it in the Documatic explorer panel you'll find the link to the %SYS.Task class. Here's a link to the online copy for 2017.1
http://docs.intersystems.com/cache20171/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25SYS.Task
I'm seeing ExportTasks and ImportTasks methods, both inherited from %SYS.TaskSuper
I am clicking on the class and not the package in my build. and getting what looks like package documentation. There was obviously an issue in the build I was using. Regardless the code for export worked. But I can't get the import to function. Looking as exporting globals now.
Eduard,
Thanks for the info. I was looking at that but could not find the global reference in the class definition or in searching the global list. Now I know why. It's not in a global by itself. Let me see if this will work.
Ok, Here is the procedure that worked for me:
Export:
Import
This client is on an earlier version.
Did you find the ExportTasks and ImportTasks classmethods of %SYS.TaskSuper, which AFAIK is the superclass of all tasks?
http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25SYS.TaskSuper#METHOD_ExportTasks
I haven't tried them myself, but at first sight they look promising.
I think that using ExportTasks and ImportTasks methods of %SYS.TaskSuper class as proposed by @Sean Connelly and @John Murray would be a better solution as:
I agree except that the import would not work. There is little documentation on utilizing these tools and I cannot even read the source code.
What error are you getting from Import method?
ERROR #6037: Nothing imported.
Not terribly helpful I'm afraid. I know that when I attempted to use SQL I was getting many Field Read Only errors. So this may be related to that.
Can you post XML file you're trying to import?
Looks like it's empty.
Eduard,
Ok, I had not noticed that, but you are correct. I had tried other methods first as I noted before and ran into issues loading onto the new systems. I had obviously skipped the step of verifying the export file when I tried this method. So I gather that you HAVE to pass in a list of IDS to export. Leaving it blank does not export all. As I mentioned the documentation is extremely sparse on this api. I will test this again later.
Yes.
1. Execute this to get a list of available flags and qualifiers:
Qualifiers are preferable to use.
2. I'd rather go with programmatic access. Write code that's:
What system task did you modify?
Let me clarify. this has to do with the ExportTasks and ImportTasks methods of %SYS.Task class. I need to know the qspec options that have impact on these processes.
as to question 2. The process is that they are setting up a new server for backup and want to replicate what they have setup for the current server. Exporting and importing what is currently present is the best way. If they are going to write a program then they could just as well compare each existing task and do the changes manually. There is an ongoing maintenance side to this which would also be better done with an export an import.
So to the original question is there anyway to tell ImportTasks to override the tasks that exist?
1. Import task has these two qualifiers:
They do not affect import.
2. No. If you check exported xml, you can see that exported tasks do not contain IDs, so, on import they could not overwrite existing tasks. Not sure about how correlate/next work on ID fields btw.
It's the easiest way. The best way would be to write and document a script (ObjectScript code) that transforms base instance into what they need. This way changes are documented and adding another server is easy.
I see that the ID is not in the export. However the import does figure out how to match an import to an existing item since it does not allow you to overwrite that existing records. Otherwise we would see a duplication of records under new ID's.
As far as the methods to use I would have to disagree with this recommendation. A system administrator should not have to write code to maintain the systems under their care. Documentation is important, however that can be accomplished with a literal document. Then, failing to have a export/import or enterprise management function, those changes would manually be done to all effected systems. Writing code is less clear to everyone and is no less work.
This feels more like a DevOps process, where coding is more acceptable. Anyway, maybe you need to ask a separate question on configuration synchronization best practices?
Eduard,
I had some additional questions.
Interesting. I am looking at Cache version 2017.1.0.792 and these classes have non of this documentation. I will have to see if this exists on the version the customer is using. This is how the Class reference for %SYS.Task looks on that version:
You can export/import ^SYS("Task","TaskD") global directly, which contains task definitions data.
Some properties are computed (i.e. LastFinished), and could probably cause this error.
Try to export/import minimal set of columns.
Alternative approach would be writing code to generate tasks.
Not sure what version you are using.
In v 2017.2.1, if you edit the task, there is an export button to export the tasks.
On System Operation | Task Manager menu, there is an Import Tasks menu item.
You may have to edit the namespace name within the export if importing into a different namespace.
Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue