code: def _add_pb(pb_config: dict):
          
          # Add status field to the PB
          pb_config['status'] = 'created'
  
          # Add created and updated timestamps to the PB
          timestamp = datetime.datetime.utcnow().isoformat()
          pb_config['created'] = timestamp
          pb_config['updated'] = timestamp
  
          # set default priority, if not defined
          if 'priority' not in pb_config:
              pb_config['priority'] = 0
  
          # Retrieve the workflow definition
          SchedulingBlockInstance._update_workflow_definition(pb_config)
  
          # If needed, add resources and dependencies fields
          keys = ['resources_required', 'resources_assigned', 'dependencies']
          for key in keys:
              if key not in pb_config:
                  pb_config[key] = []
              for stage in pb_config['workflow_stages']:
                  if key not in stage:
                      stage[key] = []
  
          # Add PB to the the database
          key = SchedulingObject.get_key(PB_KEY, pb_config['id'])
          # DB.set_hash_values(key, pb_config)
          DB.save_dict(key, pb_config, hierarchical=False)
  
          # Add to list of PB ids
          key = '{}:active'.format(PB_KEY)
          DB.append_to_list(key, pb_config['id'])
          key = '{}:active:{}'.format(PB_KEY, pb_config['type'])
          DB.append_to_list(key, pb_config['id'])
  
          # Publish an event to to notify subscribers of the new PB
          pb = SchedulingObject(PB_KEY, pb_config['id'])
          pb.set_status('created')
docs: .