Skip to content

Commit

Permalink
Structure events and process results
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikek committed Dec 1, 2024
1 parent c1ab19c commit 2c81826
Show file tree
Hide file tree
Showing 17 changed files with 174 additions and 84 deletions.
11 changes: 11 additions & 0 deletions ESSArch_Core/WorkflowEngine/dbtask.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,17 @@ def failure(self, exc, einfo):
def create_success_event(self, msg, retval=None):
return self.create_event(celery_states.SUCCESS, msg, retval, None)

def create_event_from_task_log_dict(self, msg):
t = self.get_processtask()
if type(t.log) is dict or t.log is True:
self.event_type = t.log.get('event_type', self.event_type)
msg = t.log.get('msg', msg)
outcome = t.log.get('outcome', 'SUCCESS')
self.create_event(outcome, msg, None, None)
return True
else:
return False

def success(self, retval, args, kwargs):
'''
We use our own version of on_success so that we can call it at the end
Expand Down
1 change: 1 addition & 0 deletions ESSArch_Core/WorkflowEngine/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def _create_step(parent, flow, ip, responsible, context=None):
processstep_pos=e_idx,
hidden=flow_entry.get('hidden', False),
run_if=flow_entry.get('run_if', ''),
log=flow_entry.get('log'),
)

on_error_tasks = list(
Expand Down
7 changes: 5 additions & 2 deletions ESSArch_Core/fixity/validation/backends/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def validate(self, path, expected=None):
Validation.objects.bulk_create(objs, batch_size=100)

if delete_count + self.added + self.changed + self.renamed > 0:
msg = ('Diff-check validation of {path} against {xml} failed: '
msg = ('Redundancy check of {path} against {xml} failed: '
'{cfmd} confirmed, {a} added, {c} changed, {r} renamed, {d} deleted').format(
path=path, xml=self.context, cfmd=self.confirmed, a=self.added, c=self.changed, r=self.renamed,
d=delete_count)
Expand Down Expand Up @@ -315,7 +315,10 @@ def validate(self, path, expected=None):
logger.warning(msg)
raise ValidationError(msg)

logger.info("Successful comparison of {path} against {xml}".format(path=path, xml=self.context))
msg = "Successful comparison of {path} against {xml}. {num} files confirmed.".format(
path=path, xml=self.context, num=len(objs))
logger.info(msg)
return msg


class XMLSchemaValidator(BaseValidator):
Expand Down
15 changes: 9 additions & 6 deletions ESSArch_Core/install/install_default_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,19 @@ def installDefaultEventTypes():
'Created AIP': {'eventType': '30200', 'category': ip_cat},
'Preserved AIP': {'eventType': '30300', 'category': ip_cat},
'Cached AIP': {'eventType': '30310', 'category': ip_cat},
'Removed the source to the SIP': {'eventType': '30400', 'category': ip_cat},
'Removed the source to the AIP': {'eventType': '30410', 'category': ip_cat},
'Clean up SIP preparation files': {'eventType': '30400', 'category': ip_cat},
'Clean up AIP preparation files': {'eventType': '30410', 'category': ip_cat},
'Ingest order completed': {'eventType': '30500', 'category': ip_cat},
'Ingest order accepted': {'eventType': '30510', 'category': ip_cat},
'Ingest order requested': {'eventType': '30520', 'category': ip_cat},
'Created DIP': {'eventType': '30600', 'category': ip_cat},
'DIP order requested': {'eventType': '30610', 'category': ip_cat},
'DIP order accepted': {'eventType': '30620', 'category': ip_cat},
'DIP order completed': {'eventType': '30630', 'category': ip_cat},
'Moved to workarea': {'eventType': '30700', 'category': ip_cat},
'Moved from workarea': {'eventType': '30710', 'category': ip_cat},
'Moved to gate from workarea': {'eventType': '30720', 'category': ip_cat},
'Moved to workspace': {'eventType': '30700', 'category': ip_cat},
'Moved from workspace': {'eventType': '30710', 'category': ip_cat},
'Moved to gate from workspace': {'eventType': '30720', 'category': ip_cat},
'Retrieved from storage': {'eventType': '30800', 'category': ip_cat},

'Unmounted the tape from drive in robot': {'eventType': '40100', 'category': ip_cat},
'Mounted the tape in drive in robot': {'eventType': '40200', 'category': ip_cat},
Expand All @@ -166,14 +167,16 @@ def installDefaultEventTypes():
'Storage medium robot': {'eventType': '40540', 'category': ip_cat},
'Data written to disk storage method': {'eventType': '40600', 'category': ip_cat},
'Data read from disk storage method': {'eventType': '40610', 'category': ip_cat},
'Data written to CAS storage method': {'eventType': '40620', 'category': ip_cat},
'Data read from CAS storage method': {'eventType': '40630', 'category': ip_cat},
'Data written to tape storage method': {'eventType': '40700', 'category': ip_cat},
'Data read from tape storage method': {'eventType': '40710', 'category': ip_cat},

'Calculated checksum ': {'eventType': '50000', 'category': ip_cat},
'Identified format': {'eventType': '50100', 'category': ip_cat},
'Validated file format': {'eventType': '50200', 'category': ip_cat},
'Validated XML file': {'eventType': '50210', 'category': ip_cat},
'Validated logical representation against physical representation': {'eventType': '50220', 'category': ip_cat},
'Redundancy check': {'eventType': '50220', 'category': ip_cat},
'Validated checksum': {'eventType': '50230', 'category': ip_cat},
'Compared XML files': {'eventType': '50240', 'category': ip_cat},
'Virus control done': {'eventType': '50300', 'category': ip_cat},
Expand Down
Loading

0 comments on commit 2c81826

Please sign in to comment.