当前位置: 首页>>代码示例>>Python>>正文


Python TaskHistory.task_id方法代码示例

本文整理汇总了Python中notification.models.TaskHistory.task_id方法的典型用法代码示例。如果您正苦于以下问题:Python TaskHistory.task_id方法的具体用法?Python TaskHistory.task_id怎么用?Python TaskHistory.task_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在notification.models.TaskHistory的用法示例。


在下文中一共展示了TaskHistory.task_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: register_task

# 需要导入模块: from notification.models import TaskHistory [as 别名]
# 或者: from notification.models.TaskHistory import task_id [as 别名]
 def register_task(self):
     task_history = TaskHistory()
     task_history.task_id = datetime.now().strftime("%Y%m%d%H%M%S")
     task_history.task_name = "switch_masters_in_zone"
     task_history.relevance = TaskHistory.RELEVANCE_WARNING
     task_history.task_status = TaskHistory.STATUS_RUNNING
     task_history.context = {'hostname': gethostname()}
     task_history.user = 'admin'
     task_history.save()
     return task_history
开发者ID:globocom,项目名称:database-as-a-service,代码行数:12,代码来源:switch_all_masters_in_zone.py

示例2: register_task

# 需要导入模块: from notification.models import TaskHistory [as 别名]
# 或者: from notification.models.TaskHistory import task_id [as 别名]
 def register_task(self, database):
     task_history = TaskHistory()
     task_history.task_id = datetime.now().strftime("%Y%m%d%H%M%S")
     task_history.task_name = self.TASK_NAME
     task_history.relevance = TaskHistory.RELEVANCE_WARNING
     task_history.task_status = TaskHistory.STATUS_RUNNING
     task_history.context = {'hostname': gethostname()}
     task_history.user = 'admin'
     task_history.db_id = database.id
     task_history.object_class = "logical_database"
     task_history.object_id = database.id
     task_history.database_name = database.name
     task_history.arguments = 'Database_name: {}'.format(database.name)
     task_history.save()
     return task_history
开发者ID:globocom,项目名称:database-as-a-service,代码行数:17,代码来源:filer_migrate.py

示例3: region_migration_start

# 需要导入模块: from notification.models import TaskHistory [as 别名]
# 或者: from notification.models.TaskHistory import task_id [as 别名]
def region_migration_start(self, infra, instances, since_step=None):
    steps = [{
        'Disable monitoring and alarms': (
            'workflow.steps.util.zabbix.DestroyAlarms',
            'workflow.steps.util.db_monitor.DisableMonitoring',
        )}, {
        'Stopping infra': (
            'workflow.steps.util.database.Stop',
            'workflow.steps.util.database.CheckIsDown',
        )}, {
        'Creating new virtual machine': (
            'workflow.steps.util.vm.MigrationCreateNewVM',
        )}, {
        'Creating new infra': (
            'workflow.steps.util.vm.MigrationWaitingBeReady',
            'workflow.steps.util.infra.MigrationCreateInstance',
            'workflow.steps.util.disk.MigrationCreateExport',
        )}, {
        'Configuring new infra': (
            'workflow.steps.util.volume_provider.MountDataVolume',
            'workflow.steps.util.plan.InitializationMigration',
            'workflow.steps.util.plan.ConfigureMigration',
            'workflow.steps.util.metric_collector.ConfigureTelegraf',
        )}, {
        'Preparing new environment': (
            'workflow.steps.util.disk.AddDiskPermissionsOldest',
            'workflow.steps.util.disk.MountOldestExportMigration',
            'workflow.steps.util.disk.CopyDataBetweenExportsMigration',
            'workflow.steps.util.disk.FilePermissionsMigration',
            'workflow.steps.util.disk.UnmountNewerExportMigration',
            'workflow.steps.util.vm.ChangeInstanceHost',
            'workflow.steps.util.vm.UpdateOSDescription',
            'workflow.steps.util.infra.OfferingMigration',
            'workflow.steps.util.infra.UpdateMigrateEnvironment',
            'workflow.steps.util.infra.UpdateMigratePlan',
        )}, {
        'Starting new infra': (
            'workflow.steps.util.database.Start',
            'workflow.steps.util.database.CheckIsUp',
            'workflow.steps.util.metric_collector.RestartTelegraf',
        )}, {
        'Enabling access': (
            'workflow.steps.util.dns.ChangeEndpoint',
            'workflow.steps.util.acl.ReplicateAclsMigration',
        )}, {
        'Destroying old infra': (
            'workflow.steps.util.disk.DisableOldestExportMigration',
            'workflow.steps.util.disk.DiskUpdateHost',
            'workflow.steps.util.vm.RemoveHostMigration',
        )}, {
        'Enabling monitoring and alarms': (
            'workflow.steps.util.db_monitor.EnableMonitoring',
            'workflow.steps.util.zabbix.CreateAlarms',
        )}, {
        'Restart replication': (
            'workflow.steps.util.database.SetSlavesMigration',
        )
    }]

    task = TaskHistory()
    task.task_id = self.request.id
    task.task_name = "migrating_zone"
    task.task_status = TaskHistory.STATUS_RUNNING
    task.context = {'infra': infra, 'instances': instances}
    task.arguments = {'infra': infra, 'instances': instances}
    task.user = 'admin'
    task.save()

    if steps_for_instances(steps, instances, task, since_step=since_step):
        task.set_status_success('Region migrated with success')
    else:
        task.set_status_error('Could not migrate region')

    database = infra.databases.first()
    database.environment = infra.environment
    database.save()
开发者ID:globocom,项目名称:database-as-a-service,代码行数:78,代码来源:tasks.py


注:本文中的notification.models.TaskHistory.task_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。