-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
dev-job-in-job branch: False positives on cycle detection #46
Comments
Comment by rclough I've looked at this again, and some discussion here: thieman#60 (comment) I think the issue is that the context needs to be treated as "immutable". Right now the code looks like (highly simplified): def verify(self, context=none):
if context is none:
logger.debug("no context set, using empty set")
context = set()
if self.name in context:
return false
context.add(self.name)
# Topological sort verifies DAG is acyclic before digging deeper
...
# Traverse nodes and verify any JobTasks
for task in topo_sorted:
if not self.implements_expandable(task):
continue
cur_job = self.parent._resolve_job(task.target_job_name)
if cur_job.name in context:
return False
# Verify this job has no internal cycles, or references to jobs
# in the current context
verified = cur_job.verify(context)
if not verified:
return False
return True I did some additional debug logging, and what happens is the The initial discussion (linked above) seems to assume pass-by-value in passing the context, which is not the case (unless I'm missing some nuance) I see two main options, but am open to other ideas:
Thoughts? |
Comment by rclough I personally think the best way is context.discard(self.name) Should be "guaranteed" (:wink:) to work because Tested it by hand and seems to work, passes existing tests as well. |
Issue by rclough
Thursday Jan 07, 2016 at 20:40 GMT
Originally opened as thieman#172
Want to note this here cause I might not be able to immediately address it.
To replicate:
In laymans terms, if you want to make a job that executes another job, twice in a row, which is entirely valid, it will assume it has a cycle.
For whatever reason, the job is not removed from the "context", which denotes which job expansions you are currently running in. I suspect this is due to a poor pass by reference/value assumption
The text was updated successfully, but these errors were encountered: