Data location inconsistency between job logs and wmstats
@vlimant was asking me about a very weird case where wmstats reports that a job was running at T2_US_Nebraska (failed job) while the condor logs in the agent vocms0303 reports that this job ran at T1_US_FNAL (notice it's the first attemp, so retry 0).

I forgot to add a link to a wmstats screenshot and a tarball of this job, from the JobCreator:
http://amaltaro.web.cern.ch/amaltaro/forWMCore/Issue_7217/

@ticoann do you have any idea of what can have happened?

diff --git a/src/python/WMCore/JobStateMachine/ChangeState.py b/src/python/WMCore/JobStateMachine/ChangeState.py
index 6460f5bbe..77fd8531a 100644
--- a/src/python/WMCore/JobStateMachine/ChangeState.py
+++ b/src/python/WMCore/JobStateMachine/ChangeState.py
@@ -318,7 +318,10 @@ class ChangeState(WMObject, WMConnectionBase):
                     jobState = "jobfailed"
                 else:
                     jobState = newstate
-                    
+                
+                # there is race condition updating couch record location and job is completed.
+                # for the fast fail job, it could miss the location update
+                job["location"] = job["fwjr"].getSiteName() or job.get("location", "Unknown")     
                 # complete fwjr document
                 job["fwjr"].setTaskName(job["task"])
                 jsonFWJR = job["fwjr"].__to_json__(None)
['src/python/WMCore/JobStateMachine/ChangeState.py']