Folders¶
[ ]:
from aapi import *
Folder¶
The default type of folder (as opposed to a simple folder) enables you to configure various settings such as scheduling, event management, adding resources, or adding notifications on the folder level. Folder-level definitions are inherited by the jobs or subfolders within the folder.
For example, you can specify scheduling criteria on the folder level instead of defining the criteria per job in the folder. All jobs in the folder will take on the rules of the folder. This reduces job definition in code.
Examples¶
[ ]:
sample_folder = Folder('MyFolder', job_list=[
JobCommand('Job1', command='echo I am a Job'),
JobCommand('Job2', command='echo I am also a Job'),
JobDummy('Job3'),
])
[ ]:
sample_folder = Folder('MyFolder',
controlm_server='controlm',
site_standard='mysitestandard',
business_fields=[
{'Department': 'HR'}, {'Company': 'BMC'}],
order_method=Folder.OrderMethod.Manual
)
SubFolder¶
A subfolder is a folder contained within another (parent) folder or subfolder. A subfolder can contain a group of jobs or a next-level subfolder. Subfolders offer many (but not all) of the capabilities that are offered by regular folders.
Examples¶
[ ]:
folder = Folder('FolderWithSubFolders', sub_folder_list=[
SubFolder('FirstSubFolder', job_list=[JobScript(
'Job1', file_name='script.sh', file_path='/home/scripts')]),
SubFolder('SecondSubFolder', job_list=[JobDummy('DummyJob')])
])
Arguments¶
controlm_server : Specifies a Control-M Scheduling Server. If more than one Control-M Scheduling Server is configured in the system, you must define the server that the folder belongs to
site_standard : Enforces the defined Site Standard to the folder and all jobs contained within the folder
business_fields : Values for the business fields of the specified Site Standard
order_method : Order method (Automatic : The folder and its jobs are automatically ordered on days specified in the ‘When’ property, Manual: The ‘When’ property is ignored. To order such a folder use the “ctm run order” API or Action Type:Run )
active_retention_policy : The retention policy for jobs in the folder or subfolder
job_list : List of Jobs
Other properties are also shared with Jobs, see the notebook Job and Folder Properties
[ ]:
folder = Folder('SampleFolder',
controlm_server='ctmserver',
site_standard='sitestd',
business_fields=[{'Department': 'HR'}, {'Company': 'BMC'}],
order_method=Folder.OrderMethod.Manual,
application='ApplicationName',
sub_application='SubApplication',
run_as='controlm',
when=Folder.When(week_days=['SUN']),
active_retention_policy=Folder.ActiveRetentionPolicy.KeepAll,
days_keep_active='41',
confirm=True,
created_by='user',
description='FolderSample with lot of properties set',
priority=Folder.Priority.High,
rerun=Folder.Rerun(every='2'),
rerun_limit=Folder.RerunLimit(times='3'),
time_zone='HAW',
variables=[{'var1': 'val'}, {'var2': 'val2'}],
job_list=[]
)