{"action":"created","issue":{"url":"https://api.github.com/repos/danthorpe/Operations/issues/147","labels_url":"https://api.github.com/repos/danthorpe/Operations/issues/147/labels{/name}","comments_url":"https://api.github.com/repos/danthorpe/Operations/issues/147/comments","events_url":"https://api.github.com/repos/danthorpe/Operations/issues/147/events","html_url":"https://github.com/danthorpe/Operations/issues/147","id":122923603,"number":147,"title":"Should Condition operations inherit their parents dependencies?","user":{"login":"anthonyherron","id":178905,"avatar_url":"https://avatars.githubusercontent.com/u/178905?v=3","gravatar_id":"","url":"https://api.github.com/users/anthonyherron","html_url":"https://github.com/anthonyherron","followers_url":"https://api.github.com/users/anthonyherron/followers","following_url":"https://api.github.com/users/anthonyherron/following{/other_user}","gists_url":"https://api.github.com/users/anthonyherron/gists{/gist_id}","starred_url":"https://api.github.com/users/anthonyherron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthonyherron/subscriptions","organizations_url":"https://api.github.com/users/anthonyherron/orgs","repos_url":"https://api.github.com/users/anthonyherron/repos","events_url":"https://api.github.com/users/anthonyherron/events{/privacy}","received_events_url":"https://api.github.com/users/anthonyherron/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/danthorpe/Operations/labels/discussion","name":"discussion","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/danthorpe/Operations/milestones/20","html_url":"https://github.com/danthorpe/Operations/milestones/2.6","labels_url":"https://api.github.com/repos/danthorpe/Operations/milestones/20/labels","id":1466540,"number":20,"title":"2.6","description":"","creator":{"login":"danthorpe","id":309420,"avatar_url":"https://avatars.githubusercontent.com/u/309420?v=3","gravatar_id":"","url":"https://api.github.com/users/danthorpe","html_url":"https://github.com/danthorpe","followers_url":"https://api.github.com/users/danthorpe/followers","following_url":"https://api.github.com/users/danthorpe/following{/other_user}","gists_url":"https://api.github.com/users/danthorpe/gists{/gist_id}","starred_url":"https://api.github.com/users/danthorpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danthorpe/subscriptions","organizations_url":"https://api.github.com/users/danthorpe/orgs","repos_url":"https://api.github.com/users/danthorpe/repos","events_url":"https://api.github.com/users/danthorpe/events{/privacy}","received_events_url":"https://api.github.com/users/danthorpe/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2015-12-18T11:56:03Z","updated_at":"2015-12-18T11:56:38Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2015-12-18T10:32:32Z","updated_at":"2015-12-18T12:36:40Z","closed_at":null,"body":"Hey Dan, I have a question somewhat related to [#129](https://github.com/danthorpe/Operations/issues/129). There are definitely ways around to get this to work, so perhaps it's a bit philosophical. I have a code example below:\r\n\r\n```swift\r\n\t\t// Example condition that a login is required to happen\r\n\t\tclass LoggedInCondition: OperationCondition {\r\n\t\t\t\r\n\t\t\tvar name: String { return \"\\(self.dynamicType)\" }\r\n\t\t\tvar isMutuallyExclusive: Bool { return false }\r\n\r\n\t\t\tfunc dependencyForOperation(operation: Operation) -> NSOperation? {\r\n\t\t\t\tprint(\"\\(self.dynamicType): \" + __FUNCTION__)\r\n\t\t\t\treturn LoginOperation()\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfunc evaluateForOperation(operation: Operation, completion: OperationConditionResult -> Void) {\r\n\t\t\t\tprint(\"\\(self.dynamicType): \" + __FUNCTION__)\r\n\t\t\t\tcompletion(.Satisfied)\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// Let's imagine this class is used to perform some initial config\r\n\t\tclass InitialOperation: Operation {\r\n\t\t\tprivate override func execute() {\r\n\t\t\t\tprint(\"\\(self.dynamicType): \" + __FUNCTION__)\r\n\t\t\t\t// Arbitrary delay used to show order of execution\r\n\t\t\t\tlet delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(5 * Double(NSEC_PER_SEC)))\r\n\t\t\t\tdispatch_after(delayTime, dispatch_get_main_queue()) {\r\n\t\t\t\t\tself.finish()\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tclass LoginOperation: Operation {\r\n\t\t\tprivate override func execute() {\r\n\t\t\t\tprint(\"\\(self.dynamicType): \" + __FUNCTION__)\r\n\t\t\t\tfinish()\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tclass SimpleOperation: Operation {\r\n\t\t\tprivate override func execute() {\r\n\t\t\t\tprint(\"\\(self.dynamicType): \" + __FUNCTION__)\r\n\t\t\t\tfinish()\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tlet initialOperation = InitialOperation()\r\n\t\tlet simpleOperation = SimpleOperation()\r\n\t\t\r\n\t\tsimpleOperation.addDependency(initialOperation)\r\n\t\t// Before the simple operation can be performed, there's a requirement to be logged in\r\n\t\tsimpleOperation.addCondition(LoggedInCondition())\r\n\t\t// Add the operations, would behave the same if this was a group\r\n\t\toperationQueue.addOperation(initialOperation)\r\n\t\toperationQueue.addOperation(simpleOperation)\r\n```\r\n\r\nConsole output:\r\n```\r\n(LoggedInCondition #1): dependencyForOperation\r\n(LoginOperation #1): execute()\r\n(InitialOperation #1): execute()\r\n\r\n// The delay happens here\r\n\r\n(LoggedInCondition #1): evaluateForOperation(_:completion:)\r\n(SimpleOperation #1): execute()\r\n```\r\n\r\nMy question being... should the operation LoginOperation - which is returned by LoggedInCondition inherit the dependencies of SimpleOperation? Right now the operation is returned and executed concurrently. \r\n\r\nThe reason I ask being the condition's operations may itself have InitialOperation as a dependency - we can get around that of course. But what about the fact that LoggedInCondition's operation is potentially needlessly executed if the InitialOperation's dependencies fail? "},"comment":{"url":"https://api.github.com/repos/danthorpe/Operations/issues/comments/165768475","html_url":"https://github.com/danthorpe/Operations/issues/147#issuecomment-165768475","issue_url":"https://api.github.com/repos/danthorpe/Operations/issues/147","id":165768475,"user":{"login":"danthorpe","id":309420,"avatar_url":"https://avatars.githubusercontent.com/u/309420?v=3","gravatar_id":"","url":"https://api.github.com/users/danthorpe","html_url":"https://github.com/danthorpe","followers_url":"https://api.github.com/users/danthorpe/followers","following_url":"https://api.github.com/users/danthorpe/following{/other_user}","gists_url":"https://api.github.com/users/danthorpe/gists{/gist_id}","starred_url":"https://api.github.com/users/danthorpe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danthorpe/subscriptions","organizations_url":"https://api.github.com/users/danthorpe/orgs","repos_url":"https://api.github.com/users/danthorpe/repos","events_url":"https://api.github.com/users/danthorpe/events{/privacy}","received_events_url":"https://api.github.com/users/danthorpe/received_events","type":"User","site_admin":false},"created_at":"2015-12-18T12:36:40Z","updated_at":"2015-12-18T12:36:40Z","body":"Hi @anthonyherron - I don't yet have a roadmap or contributing guidelines yet - but after I sort out 2.5 I'm going to put these in place. PRs are welcome - but things which drastically change how operations are executed need to be clearly understood / documented / assessed etc. And this is what I'm working on for  v2.5 which I hope will be done in the next day or so."}}