Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load() is failing for some jobs #29

Closed
rob-c opened this issue Oct 30, 2015 · 4 comments
Closed

load() is failing for some jobs #29

rob-c opened this issue Oct 30, 2015 · 4 comments
Assignees

Comments

@rob-c
Copy link
Member

rob-c commented Oct 30, 2015

load() function fails for multiple reasons in latest release.

This should be looked at as it's bit of a pain from a user perspective.

There is also the problem that protected attributes can't be assigned during a load. This should be addressed by not exporting protected attributes imo.

Rob

Original backtrace from Chris Jones below:

In [51]:test=load('/usera/jonesc/s24-BcDD.udsts.txt')
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'>        Traceback (most recent call last)

/var/nwork/pclr/jonesc/output/stripping/S24-B2OC-Tests/<console> in
<module>()

/cvmfs/lhcb.cern.ch/lib/lhcb/GANGA/GANGA_v601r11/install/ganga/python/Ganga/GPIDev/Persistency/__init__.py
in load(filename, returnList)
     204         if item:
     205             try:
--> 206                 this_object = eval(str(item), Ganga.GPI.__dict__)
     207                 objectList.append(this_object)
     208             except NameError as x:

/var/nwork/pclr/jonesc/output/stripping/S24-B2OC-Tests/<string> in
<module>()

/cvmfs/lhcb.cern.ch/lib/lhcb/GANGA/GANGA_v601r11/install/ganga/python/Ganga/GPIDev/Base/Proxy.py
in _init(self, *args, **kwds)
     377         for k in kwds:
     378             if getattr(self, proxyRef)._schema.hasAttribute(k):
--> 379                 setattr(self, k, kwds[k])
     380             else:
     381                 logger.warning('keyword argument in the %s
constructur ignored: %s=%s (not defined in the schema)', name, k, kwds[k])

/cvmfs/lhcb.cern.ch/lib/lhcb/GANGA/GANGA_v601r11/install/ganga/python/Ganga/GPIDev/Base/Proxy.py
in _setattr(self, x, v)
     518             raise GangaAttributeError("'%s' has no attribute
'%s'" % (getattr(self, proxyRef)._name, x))
     519
--> 520         object.__setattr__(self, x, v)
     521     helptext(_setattr, """Set a property of %(classname)s with
consistency and safety checks.
     522 Setting a [protected] or a unexisting property raises
AttributeError.""")

/cvmfs/lhcb.cern.ch/lib/lhcb/GANGA/GANGA_v601r11/install/ganga/python/Ganga/GPIDev/Base/Proxy.py
in __set__(self, obj, val)
     292                 val = makeGangaList(stripper(val))
     293         else:
--> 294             val = stripper(val)
     295
     296         # apply attribute filter to component items

/cvmfs/lhcb.cern.ch/lib/lhcb/GANGA/GANGA_v601r11/install/ganga/python/Ganga/GPIDev/Base/Proxy.py
in stripAttribute(v)
     268                 v = getattr(v, proxyRef)
     269                 logger.debug('%s property: assigned a component
object (%s used)' % (self._name, proxyRef))
--> 270             return getattr(obj,
proxyRef)._attribute_filter__set__(self._name, v)
     271
     272         # unwrap proxy

/cvmfs/lhcb.cern.ch/lib/lhcb/GANGA/GANGA_v601r11/install/ganga/python/GangaDirac/Lib/Files/DiracFile.py
in _attribute_filter__set__(self, name, value)
     177
     178             elif name == 'localDir':
--> 179                 return expandfilename(value)
     180
     181         return value

/cvmfs/lhcb.cern.ch/lib/lhcb/GANGA/GANGA_v601r11/install/ganga/python/Ganga/Utility/files.py
in expandfilename(filename)
      15 def expandfilename(filename):
      16     "expand a path or filename in a standard way so that it may
contain ~ and ${VAR} strings"
---> 17     return os.path.expandvars(os.path.expanduser(filename))
      18
      19

/cvmfs/lhcb.cern.ch/lib/lcg/releases/LCG_76root6/Python/2.7.9.p1/x86_64-slc6-gcc48-opt/lib/python2.7/posixpath.py
in expanduser(path)
     259     """Expand ~ and ~user constructions.  If user or $HOME is
unknown,
     260     do nothing."""
--> 261     if not path.startswith('~'):
     262         return path
     263     i = path.find('/', 1)

<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute
'startswith'
@rob-c rob-c self-assigned this Oct 30, 2015
@rob-c rob-c added this to the 6.1.13 milestone Oct 30, 2015
@rob-c rob-c modified the milestones: 6.1.15, 6.1.14 Nov 25, 2015
@rob-c
Copy link
Member Author

rob-c commented Nov 25, 2015

I'm pushing this back to 6.1.15 as I'm keen to get 6.1.14 into a releasable state asap.

This was was crashing due to the assignment of a protected attribute at runtime. Hiding the protected attribute 'is_prepared' which was protected fixed the problems here but caused problems elsewhere.

Until this is more completely understood I'm unhiding these attributes and will look into modifying VPrinter in 6.1.15. Now that there is a separation between VPrinter and VPrinterPrep the VPrinter can be made to treat protected attributes in the same way as hidden ones when printing out the contents of a GangaObject file.

More on this to come but until then export works as expected and if a user wants to 'load' a Job into interactive Ganga the solution is to remove any lines containing 'is_prepared'.

Given the export/load functionality is inferior to using the JobTemplate repo imo I'd advise using this anyway to store/persist jobs and export/load should only be to share jobs between users.

@rob-c
Copy link
Member Author

rob-c commented Jul 14, 2016

I think this may be fixed elsewhere I'll check shortly and make a test to verify

@rob-c
Copy link
Member Author

rob-c commented Jul 15, 2016

This should be fixed properly by #646 in that construction of an object which is locked immediately after construction should be possible.
I'll check the integration tests and add an explicit test for this before I close the PR.

@rob-c
Copy link
Member Author

rob-c commented Oct 27, 2016

This is now working at the cost that we don't crash when users attempt to use kwds which aren't in the schema of object construction. This is viewed more as a cost of backwards compatibility so I can close this as fixed.

@rob-c rob-c closed this as completed Oct 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants