Skip to main content


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

This class is used internally by InterSystems IRIS. 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


parameter DOMAIN = %Utility;
Default Localization Domain
parameter TASKS = ,AuditCopy,AuditExport,AuditPurge,Backup,CompactDBSpace,CopyNamespaceMappings,CreateDatabase,Compile,DatabaseIntegrityCheck,DataMigration,DefragmentDB,Delete,EnableEnsNamespace,Export,ExternalLangServers,FileMan,Import,SQLExport,SQLImport,SQLExportStatement,SQLImportStatement,QueryExport,JournalIntegrityCheck,LinkTable,LinkProcedure,MirrorActivateCatchupDB,MirrorRemoveDB,MirrorMountDB,MirrorAddDatabases,ModifyDatabaseSize,RebuildIndices,TuneTable,TuneTables,PurgeAllCachedQueries,JobShowPlan,JobSaveQuery,JobPossiblePlans,JobComparePlans,ShardActivate,ShardAssign,ShardVerify,ShardRebalance,Task1;
This defines the allowed tasks that this class can run


classmethod ActivateShard(ByRef pParms) as %Status
classmethod AssignShard(ByRef pParms) as %Status
Assign new shard in the background
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 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 DefragmentDB(ByRef pParms) as %Status
classmethod Delete(ByRef pParms, ByRef tItems) as %Status
Start Delete routines/classes
classmethod EnableEnsNamespace(ByRef pParms) as %Status
Enable productions for a 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 ExternalLangServers(ByRef pParms) as %Status
Check status of external language servers
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 JobComparePlans(ByRef pParms) as %Status
Run Compare Show Plans process in the background
classmethod JobPossiblePlans(ByRef pParms) as %Status
Run Possible Plans process in the background
classmethod JobSaveQuery(ByRef pParms) as %Status
Run Save Query (for pTools) process in the background
classmethod JobShowPlan(ByRef pParms) as %Status
Run Show Plan process in the background
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 RebalanceShard(ByRef pParms) as %Status
Rebalance shards in the background
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 SQLExportStatement(ByRef pParms) as %Status
classmethod SQLImport(ByRef pParms) as %Status
Start SQL Import
classmethod SQLImportStatement(ByRef pParms) as %Status
classmethod Task1(ByRef pParms) as %Status
Test task
classmethod TuneTables(ByRef pParms) as %Status
Tune all tables in a schema
classmethod VerifyShard(ByRef pParms) as %Status
Verify shards in the background
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, SysBGTaskId
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

FeedbackOpens in a new tab