-
Notifications
You must be signed in to change notification settings - Fork 36
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
Accessing Project from Job #423
Comments
@javierbg Thank you for reporting! 👍 |
@javierbg I agree this feature would be useful and we may implement it as you described in signac 2.0. There are some edge cases that could be problematic if we changed this currently, but for most cases |
See also #96 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@glotzerlab/signac-committers should we revisit this going into signac 2.0? It would be possible to change this now, does anyone see any downsides? |
I have spent some time thinking about this and can’t think of any downsides. I propose the project property is purposefully public, prior to publishing post-1.x packages. (Alliteration is fun.) |
I personally use |
I can see another use case: saving a plot from an aggregate back to the project directory for display using the dashboard project overview. |
Awesome. Here is a proposal for implementation:
@property
def project(self):
"""Return the project that contains this job."""
return self._project
As an extension of this proposal, we could make assignment of the project property trigger a “move” of the job. We could do that by adding a setter, and we already have methods to move jobs from one project to another that handle the project cache invalidation correctly. We would also have to invalidate the job’s cached properties. I’ll label this a good first issue since I don’t anticipate any major design challenges in the first portion of the implementation proposal for the property. |
The only change I would make to the above instructions is that we'll want to branch off of While I am still in favor of this, and all the necessary upstream changes have now been made to enable this feature, I do not think this is a blocker for 2.0. This is a nice-to-have feature, but it's not critical and there's no reason that it couldn't be added in a minor release. Especially since we've marked it as a good first issue I would like to leave it available rather than pushing to complete it for 2.0 |
Following up: |
Resolved by #808. |
Feature description
Sometimes I need to access the
Project
object from ajob
, for example to access the project-widedata
attribute. Currently, in order to achieve this, a module-wide variable has to be created for the project, but this could span out over several modules and need to load/import the project from each one.Proposed solution
Exposing the already present
job._project
asjob.project
. If this is not possible in the near future, the current way of doing things could be explained in the docs (I was not able to find it, if it is not there I could add it myself).The text was updated successfully, but these errors were encountered: