This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Home > Class Reference > %SYS namespace > %CSP.UI.System.BackgroundTask


class %CSP.UI.System.BackgroundTask extends %Library.RegisteredObject

This class is used internally by Caché. You should not make direct use of it within your applications. There is no guarantee made about either the behavior or future operation of this class.

This class supplies the ManagementPortal with a way to execute certain tasks as background jobs.
For example, you can rebuild indices for a class:

  Set tParms("ClassName") = "Sample.Person"
  Set tSC = ..RunTask("RebuildIndices","SAMPLES",.tParms,.tJob)

Method Inventory (Including Private)


parameter DOMAIN = %Utility;
Default Localization Domain
parameter TASKS = ,AuditCopy,AuditExport,AuditPurge,Backup,CleanDBSpace,CompactDBSpace,CopyNamespaceMappings,CreateDatabase,Compile,DatabaseIntegrityCheck,DataMigration,Delete,EnableEnsNamespace,Export,FileMan,Import,SQLExport,SQLImport,QueryExport,JournalIntegrityCheck,LinkTable,LinkProcedure,MirrorActivateCatchupDB,MirrorRemoveDB,MirrorMountDB,MirrorAddDatabases,ModifyDatabaseSize,RebuildIndices,TuneTables,PurgeAllCachedQueries,Task1,;
This defines the allowed tasks that this class can run

Methods (Including Private)

classmethod AuditCopy(ByRef pParms) as %Status
Start Copy audit log to another namespace
classmethod AuditExport(ByRef pParms) as %Status
Start Export audit log
classmethod AuditPurge(ByRef pParms) as %Status
Start Purge audit log
classmethod CleanDBSpace(ByRef pParms) as %Status
Return unused db space
classmethod CompactDBSpace(ByRef pParms) as %Status
Return unused db space
classmethod Compile(ByRef pParms, ByRef tItems) as %Status
Start Compile routines/classes
classmethod CopyNamespaceMappings(ByRef pParms) as %Status
Copy Mappings from one Namespace to another
classmethod CreateDatabase(ByRef pParms) as %Status
Create a database
classmethod DataMigration(ByRef pParms, ByRef tItems) as %Status
Sart SQL Data Migration
classmethod DatabaseIntegrityCheck(ByRef pParms) as %Status
Start database file integrity check. After finish, transform results to file.
classmethod Delete(ByRef pParms, ByRef tItems) as %Status
Start Delete routines/classes
classmethod EnableEnsNamespace(ByRef pParms) as %Status
Enable Ensemble Namespace
classmethod EnumerateTasksClose(ByRef qHandle As %Binary) as %Status
classmethod EnumerateTasksExecute(ByRef qHandle As %Binary) as %Status
classmethod EnumerateTasksFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) as %Status
classmethod ErrorLogClose(QHandle As %Binary) as %Status
classmethod ErrorLogExecute(ByRef QHandle As %Binary, %pid As %Library.String) as %Status
classmethod ErrorLogFetch(ByRef QHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) as %Status
classmethod Export(ByRef pParms, ByRef tItems) as %Status
Start Export globals/routines/classes
classmethod FileMan(ByRef pParms, ByRef pItems) as %Status
Map FileMan files to InterSystems classes
classmethod Import(ByRef pParms, ByRef tItems) as %Status
Start Import globals/routines/classes
classmethod JournalIntegrityCheck(ByRef pParms) as %Status
Start journal file integrity check
classmethod LinkProcedure(ByRef pParms, ByRef tItems) as %Status
Start SQL Link Procedure
classmethod LinkTable(ByRef pParms, ByRef tItems) as %Status
Start SQL Link Table
classmethod MirrorActivateCatchupDB(ByRef pParms, ByRef pItems) as %Status
Activate and/or catchup Mirror DBs
classmethod MirrorAddDatabases(ByRef pParms, ByRef pItems) as %Status
Add databases to mirror
classmethod MirrorMountDB(ByRef pParms, ByRef pItems) as %Status
Mount Mirror DBs
classmethod MirrorRemoveDB(ByRef pParms, ByRef pItems) as %Status
Remove DBs from mirror
classmethod ModifyDatabaseSize(ByRef pParms) as %Status
Modify database size
classmethod PurgeAllCachedQueries() as %Status
Purge all cached queries from all namespaces
classmethod QueryExport(ByRef pParms) as %Status
Start SQL Export Dynamic Query
classmethod RebuildIndices(ByRef pParms) as %Status
Rebuild indices for a class
classmethod RunBackgroundTask(pTask As %String, pNS As %String, pParmList As %List, pIdx As %Integer)
This wrapper method is run in the background job. pParms is a list of parameters.
classmethod RunTask(pTask As %String, pNS As %String, ByRef pParms As %String, ByRef tItems As %String = "", ByRef pJob As %Integer) as %Status
Use this method to request a background task pTask is name of task to run; it must one of the entries in the TASKS parameter.
pNS is namespace to run task in.
pParms is a array containing parameters for the task in the form pParms(parm)=value.
It returns a PID# if the task is started, or 0 if it fails to start.
classmethod SQLExport(ByRef pParms) as %Status
Start SQL Export
classmethod SQLImport(ByRef pParms) as %Status
Start SQL Import
classmethod Task1(ByRef pParms) as %Status
Test task
classmethod TuneTables(ByRef pParms) as %Status
Tune all tables in a schema
classmethod WriteDone()
This method writes generic Status of "Done".
classmethod WriteError(ErrorMessage)
This method writes generic Status of "ERROR" and error message to Details.


query EnumerateTasks()
Selects ID As %Integer, StartTime As %TimeStamp, Namespace As %String, Task As %String, Status As %String, Details As %String, ErrorCount As %String
Return a list of currently excuting (or failed) background Management Portal tasks.
query ErrorLog(%pid As %Library.Integer)
Selects Type As %String, ErrorNo As %Integer, ErrorText As %String, Row As %Integer

Inherited Members

Inherited Methods (Including Private)