@celery_app.task(base=ArchiverTask, ignore_result=False)
@logged('archive_node')
def archive_node(stat_results, job_pk):
 create_app_context()
 job = ArchiveJob.load(job_pk)
 (src, dst, user) = job.info()
 logger.info('Archiving node: {0}'.format(src._id))
 if (not isinstance(stat_results, list)):
  stat_results = [stat_results]
 stat_result = AggregateStatResult(dst._id, dst.title, targets=stat_results)
 if ((NO_ARCHIVE_LIMIT not in job.initiator.system_tags) and (stat_result.disk_usage > settings.MAX_ARCHIVE_SIZE)):
  raise ArchiverSizeExceeded(result=stat_result)
 else:
  if (not stat_result.targets):
   job.status = ARCHIVER_SUCCESS
   job.save()
  for result in stat_result.targets:
   if (not result.num_files):
    job.update_target(result.target_name, ARCHIVER_SUCCESS)
   else:
    archive_addon.delay(addon_short_name=result.target_name, job_pk=job_pk, stat_result=result)
  project_signals.archive_callback.send(dst)

@ celery_app . task ( base = ArchiverTask , ignore_result = False ) @ logged ( 'archive_node' ) def archive_node ( stat_results , job_pk ) : create_app_context ( ) job = ArchiveJob . load ( job_pk ) ( src , dst , user ) = job . info ( ) logger . info ( 'Archiving node: {0}' . format ( src . _id ) ) if ( not isinstance ( stat_results , list ) ) : stat_results = [ stat_results ] stat_result = AggregateStatResult ( dst . _id , dst . title , targets = stat_results ) if ( ( NO_ARCHIVE_LIMIT not in job . initiator . system_tags ) and ( stat_result . disk_usage > settings . MAX_ARCHIVE_SIZE ) ) : raise ArchiverSizeExceeded ( result = stat_result ) else : if ( not stat_result . targets ) : job . status = ARCHIVER_SUCCESS job . save ( ) for result in stat_result . targets : if ( not result . num_files ) : job . update_target ( result . target_name , ARCHIVER_SUCCESS ) else : archive_addon . delay ( addon_short_name = result . target_name , job_pk = job_pk , stat_result = result ) project_signals . archive_callback . send ( dst )
first use the results of #stat_node to check disk usage of the initiated registration .