anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: perfsonar/pscheduler
Issue: Archiving fails if reference is not set

When creating a task, if you don't specify anything for the `reference` field, which is supposed to be optional, archiving fails, in a way that is difficult to detect the cause.

Once you set `reference` to something (we just used dummy data, I think even an empty object `{}` would have worked), archiving works as expected. 

Note that we ran into this issue using our custom scheduler, not psconfig.

Apparently `psconfig` supplies a `reference` field, which is why others have not had this issue.

Changed files:
pscheduler-archiver-esmond/esmond/esmond_util.py

diff --git a/pscheduler-archiver-esmond/esmond/esmond_util.py b/pscheduler-archiver-esmond/esmond/esmond_util.py
index 68257c51f..38331e111 100644
--- a/pscheduler-archiver-esmond/esmond/esmond_util.py
+++ b/pscheduler-archiver-esmond/esmond/esmond_util.py
@@ -443,6 +443,9 @@ class EsmondBaseRecord:
             self.metadata[key] = val
             
     def add_reference_metadata(self, reference={}):
+        if reference is None:
+            return
+        
         for field in reference:
             if field.startswith('_'):
                 continue