{"action":"created","comment":{"url":"https://api.github.com/repos/Dynflow/dynflow/pulls/comments/35629632","id":35629632,"diff_hunk":"@@ -0,0 +1,59 @@\n+module Dynflow\n+  class ScheduledPlan < Serializable\n+\n+    include Algebrick::TypeCheck\n+\n+    attr_reader :execution_plan_uuid, :start_at, :start_before, :args\n+\n+    def initialize(world, execution_plan_uuid, start_at, start_before, args = [], args_serializer = nil)\n+      @world               = Type! world, World\n+      @execution_plan_uuid = Type! execution_plan_uuid, String\n+      @start_at            = Type! start_at, Time\n+      @start_before        = Type! start_before, Time, NilClass\n+      @args                = Type! args, Array\n+      @args_serializer     = Type! args_serializer, Serializers::Abstract\n+    end\n+\n+    def execution_plan\n+      @execution_plan ||= @world.persistence.load_execution_plan(@execution_plan_uuid)\n+    end\n+\n+    def plan\n+      execution_plan.root_plan_step.load_action\n+      execution_plan.generate_action_id\n+      execution_plan.generate_step_id\n+      execution_plan.plan(*@args)\n+    end\n+\n+    def timeout\n+      execution_plan.root_plan_step.state = :error\n+      execution_plan.root_plan_step.error = ::Dynflow::ExecutionPlan::Steps::Error.new(\"Execution plan could not be started before set time (#{@start_before})\")\n+      execution_plan.root_plan_step.save\n+      execution_plan.execution_history.add 'timeout', @world.id\n+      execution_plan.update_state :stopped\n+    end\n+\n+    def execute\n+      @world.execute(execution_plan.id)\n+    end\n+\n+    def to_hash\n+       recursive_to_hash :execution_plan_uuid => @execution_plan_uuid,\n+                         :start_at            => time_to_str(@start_at),\n+                         :start_before        => time_to_str(@start_before),\n+                         :args                => @args_serializer.serialize,\n+                         :args_serializer     => @args_serializer.class.name\n+    end\n+\n+    # @api private\n+    def self.new_from_hash(world, hash, *args)\n+      serializer = hash[:args_serializer].constantize.new","path":"lib/dynflow/scheduled_plan.rb","position":50,"original_position":50,"commit_id":"bc4c3aae3287ac9b78d66c482d5c6abb8e5e0ac4","original_commit_id":"bc4c3aae3287ac9b78d66c482d5c6abb8e5e0ac4","user":{"login":"adamruzicka","id":7326770,"avatar_url":"https://avatars.githubusercontent.com/u/7326770?v=3","gravatar_id":"","url":"https://api.github.com/users/adamruzicka","html_url":"https://github.com/adamruzicka","followers_url":"https://api.github.com/users/adamruzicka/followers","following_url":"https://api.github.com/users/adamruzicka/following{/other_user}","gists_url":"https://api.github.com/users/adamruzicka/gists{/gist_id}","starred_url":"https://api.github.com/users/adamruzicka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamruzicka/subscriptions","organizations_url":"https://api.github.com/users/adamruzicka/orgs","repos_url":"https://api.github.com/users/adamruzicka/repos","events_url":"https://api.github.com/users/adamruzicka/events{/privacy}","received_events_url":"https://api.github.com/users/adamruzicka/received_events","type":"User","site_admin":false},"body":"I haven't though of this, your suggestion seems like a reasonable solution to it.","created_at":"2015-07-28T09:31:11Z","updated_at":"2015-07-28T09:31:11Z","html_url":"https://github.com/Dynflow/dynflow/pull/157#discussion_r35629632","pull_request_url":"https://api.github.com/repos/Dynflow/dynflow/pulls/157","_links":{"self":{"href":"https://api.github.com/repos/Dynflow/dynflow/pulls/comments/35629632"},"html":{"href":"https://github.com/Dynflow/dynflow/pull/157#discussion_r35629632"},"pull_request":{"href":"https://api.github.com/repos/Dynflow/dynflow/pulls/157"}}},"pull_request":{"url":"https://api.github.com/repos/Dynflow/dynflow/pulls/157","id":40438005,"html_url":"https://github.com/Dynflow/dynflow/pull/157","diff_url":"https://github.com/Dynflow/dynflow/pull/157.diff","patch_url":"https://github.com/Dynflow/dynflow/pull/157.patch","issue_url":"https://api.github.com/repos/Dynflow/dynflow/issues/157","number":157,"state":"open","locked":false,"title":"Refs #10753 - Allows setting future time of execution","user":{"login":"adamruzicka","id":7326770,"avatar_url":"https://avatars.githubusercontent.com/u/7326770?v=3","gravatar_id":"","url":"https://api.github.com/users/adamruzicka","html_url":"https://github.com/adamruzicka","followers_url":"https://api.github.com/users/adamruzicka/followers","following_url":"https://api.github.com/users/adamruzicka/following{/other_user}","gists_url":"https://api.github.com/users/adamruzicka/gists{/gist_id}","starred_url":"https://api.github.com/users/adamruzicka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamruzicka/subscriptions","organizations_url":"https://api.github.com/users/adamruzicka/orgs","repos_url":"https://api.github.com/users/adamruzicka/repos","events_url":"https://api.github.com/users/adamruzicka/events{/privacy}","received_events_url":"https://api.github.com/users/adamruzicka/received_events","type":"User","site_admin":false},"body":"- [x] basic implementation\r\n- [x] tests\r\n- [x] docs","created_at":"2015-07-21T09:27:32Z","updated_at":"2015-07-28T09:31:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d987d75d9059f4560f873acd7aacde7b53f27e50","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Dynflow/dynflow/pulls/157/commits","review_comments_url":"https://api.github.com/repos/Dynflow/dynflow/pulls/157/comments","review_comment_url":"https://api.github.com/repos/Dynflow/dynflow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Dynflow/dynflow/issues/157/comments","statuses_url":"https://api.github.com/repos/Dynflow/dynflow/statuses/bc4c3aae3287ac9b78d66c482d5c6abb8e5e0ac4","head":{"label":"adamruzicka:future_execution","ref":"future_execution","sha":"bc4c3aae3287ac9b78d66c482d5c6abb8e5e0ac4","user":{"login":"adamruzicka","id":7326770,"avatar_url":"https://avatars.githubusercontent.com/u/7326770?v=3","gravatar_id":"","url":"https://api.github.com/users/adamruzicka","html_url":"https://github.com/adamruzicka","followers_url":"https://api.github.com/users/adamruzicka/followers","following_url":"https://api.github.com/users/adamruzicka/following{/other_user}","gists_url":"https://api.github.com/users/adamruzicka/gists{/gist_id}","starred_url":"https://api.github.com/users/adamruzicka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamruzicka/subscriptions","organizations_url":"https://api.github.com/users/adamruzicka/orgs","repos_url":"https://api.github.com/users/adamruzicka/repos","events_url":"https://api.github.com/users/adamruzicka/events{/privacy}","received_events_url":"https://api.github.com/users/adamruzicka/received_events","type":"User","site_admin":false},"repo":{"id":19110252,"name":"dynflow","full_name":"adamruzicka/dynflow","owner":{"login":"adamruzicka","id":7326770,"avatar_url":"https://avatars.githubusercontent.com/u/7326770?v=3","gravatar_id":"","url":"https://api.github.com/users/adamruzicka","html_url":"https://github.com/adamruzicka","followers_url":"https://api.github.com/users/adamruzicka/followers","following_url":"https://api.github.com/users/adamruzicka/following{/other_user}","gists_url":"https://api.github.com/users/adamruzicka/gists{/gist_id}","starred_url":"https://api.github.com/users/adamruzicka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamruzicka/subscriptions","organizations_url":"https://api.github.com/users/adamruzicka/orgs","repos_url":"https://api.github.com/users/adamruzicka/repos","events_url":"https://api.github.com/users/adamruzicka/events{/privacy}","received_events_url":"https://api.github.com/users/adamruzicka/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adamruzicka/dynflow","description":"DYNamic workFLOW engine","fork":true,"url":"https://api.github.com/repos/adamruzicka/dynflow","forks_url":"https://api.github.com/repos/adamruzicka/dynflow/forks","keys_url":"https://api.github.com/repos/adamruzicka/dynflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adamruzicka/dynflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adamruzicka/dynflow/teams","hooks_url":"https://api.github.com/repos/adamruzicka/dynflow/hooks","issue_events_url":"https://api.github.com/repos/adamruzicka/dynflow/issues/events{/number}","events_url":"https://api.github.com/repos/adamruzicka/dynflow/events","assignees_url":"https://api.github.com/repos/adamruzicka/dynflow/assignees{/user}","branches_url":"https://api.github.com/repos/adamruzicka/dynflow/branches{/branch}","tags_url":"https://api.github.com/repos/adamruzicka/dynflow/tags","blobs_url":"https://api.github.com/repos/adamruzicka/dynflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adamruzicka/dynflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adamruzicka/dynflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/adamruzicka/dynflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adamruzicka/dynflow/statuses/{sha}","languages_url":"https://api.github.com/repos/adamruzicka/dynflow/languages","stargazers_url":"https://api.github.com/repos/adamruzicka/dynflow/stargazers","contributors_url":"https://api.github.com/repos/adamruzicka/dynflow/contributors","subscribers_url":"https://api.github.com/repos/adamruzicka/dynflow/subscribers","subscription_url":"https://api.github.com/repos/adamruzicka/dynflow/subscription","commits_url":"https://api.github.com/repos/adamruzicka/dynflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/adamruzicka/dynflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/adamruzicka/dynflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/adamruzicka/dynflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/adamruzicka/dynflow/contents/{+path}","compare_url":"https://api.github.com/repos/adamruzicka/dynflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adamruzicka/dynflow/merges","archive_url":"https://api.github.com/repos/adamruzicka/dynflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adamruzicka/dynflow/downloads","issues_url":"https://api.github.com/repos/adamruzicka/dynflow/issues{/number}","pulls_url":"https://api.github.com/repos/adamruzicka/dynflow/pulls{/number}","milestones_url":"https://api.github.com/repos/adamruzicka/dynflow/milestones{/number}","notifications_url":"https://api.github.com/repos/adamruzicka/dynflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adamruzicka/dynflow/labels{/name}","releases_url":"https://api.github.com/repos/adamruzicka/dynflow/releases{/id}","created_at":"2014-04-24T13:53:55Z","updated_at":"2014-06-16T09:02:44Z","pushed_at":"2015-07-28T08:24:20Z","git_url":"git://github.com/adamruzicka/dynflow.git","ssh_url":"git@github.com:adamruzicka/dynflow.git","clone_url":"https://github.com/adamruzicka/dynflow.git","svn_url":"https://github.com/adamruzicka/dynflow","homepage":null,"size":2125,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Dynflow:master","ref":"master","sha":"b362f292a728bd71490c8752ebacf095e00011e0","user":{"login":"Dynflow","id":6445287,"avatar_url":"https://avatars.githubusercontent.com/u/6445287?v=3","gravatar_id":"","url":"https://api.github.com/users/Dynflow","html_url":"https://github.com/Dynflow","followers_url":"https://api.github.com/users/Dynflow/followers","following_url":"https://api.github.com/users/Dynflow/following{/other_user}","gists_url":"https://api.github.com/users/Dynflow/gists{/gist_id}","starred_url":"https://api.github.com/users/Dynflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dynflow/subscriptions","organizations_url":"https://api.github.com/users/Dynflow/orgs","repos_url":"https://api.github.com/users/Dynflow/repos","events_url":"https://api.github.com/users/Dynflow/events{/privacy}","received_events_url":"https://api.github.com/users/Dynflow/received_events","type":"Organization","site_admin":false},"repo":{"id":9658764,"name":"dynflow","full_name":"Dynflow/dynflow","owner":{"login":"Dynflow","id":6445287,"avatar_url":"https://avatars.githubusercontent.com/u/6445287?v=3","gravatar_id":"","url":"https://api.github.com/users/Dynflow","html_url":"https://github.com/Dynflow","followers_url":"https://api.github.com/users/Dynflow/followers","following_url":"https://api.github.com/users/Dynflow/following{/other_user}","gists_url":"https://api.github.com/users/Dynflow/gists{/gist_id}","starred_url":"https://api.github.com/users/Dynflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dynflow/subscriptions","organizations_url":"https://api.github.com/users/Dynflow/orgs","repos_url":"https://api.github.com/users/Dynflow/repos","events_url":"https://api.github.com/users/Dynflow/events{/privacy}","received_events_url":"https://api.github.com/users/Dynflow/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Dynflow/dynflow","description":"DYNamic workFLOW orchestration engine","fork":false,"url":"https://api.github.com/repos/Dynflow/dynflow","forks_url":"https://api.github.com/repos/Dynflow/dynflow/forks","keys_url":"https://api.github.com/repos/Dynflow/dynflow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Dynflow/dynflow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Dynflow/dynflow/teams","hooks_url":"https://api.github.com/repos/Dynflow/dynflow/hooks","issue_events_url":"https://api.github.com/repos/Dynflow/dynflow/issues/events{/number}","events_url":"https://api.github.com/repos/Dynflow/dynflow/events","assignees_url":"https://api.github.com/repos/Dynflow/dynflow/assignees{/user}","branches_url":"https://api.github.com/repos/Dynflow/dynflow/branches{/branch}","tags_url":"https://api.github.com/repos/Dynflow/dynflow/tags","blobs_url":"https://api.github.com/repos/Dynflow/dynflow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Dynflow/dynflow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Dynflow/dynflow/git/refs{/sha}","trees_url":"https://api.github.com/repos/Dynflow/dynflow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Dynflow/dynflow/statuses/{sha}","languages_url":"https://api.github.com/repos/Dynflow/dynflow/languages","stargazers_url":"https://api.github.com/repos/Dynflow/dynflow/stargazers","contributors_url":"https://api.github.com/repos/Dynflow/dynflow/contributors","subscribers_url":"https://api.github.com/repos/Dynflow/dynflow/subscribers","subscription_url":"https://api.github.com/repos/Dynflow/dynflow/subscription","commits_url":"https://api.github.com/repos/Dynflow/dynflow/commits{/sha}","git_commits_url":"https://api.github.com/repos/Dynflow/dynflow/git/commits{/sha}","comments_url":"https://api.github.com/repos/Dynflow/dynflow/comments{/number}","issue_comment_url":"https://api.github.com/repos/Dynflow/dynflow/issues/comments{/number}","contents_url":"https://api.github.com/repos/Dynflow/dynflow/contents/{+path}","compare_url":"https://api.github.com/repos/Dynflow/dynflow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Dynflow/dynflow/merges","archive_url":"https://api.github.com/repos/Dynflow/dynflow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Dynflow/dynflow/downloads","issues_url":"https://api.github.com/repos/Dynflow/dynflow/issues{/number}","pulls_url":"https://api.github.com/repos/Dynflow/dynflow/pulls{/number}","milestones_url":"https://api.github.com/repos/Dynflow/dynflow/milestones{/number}","notifications_url":"https://api.github.com/repos/Dynflow/dynflow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Dynflow/dynflow/labels{/name}","releases_url":"https://api.github.com/repos/Dynflow/dynflow/releases{/id}","created_at":"2013-04-24T22:13:43Z","updated_at":"2015-07-01T23:57:53Z","pushed_at":"2015-07-28T08:24:20Z","git_url":"git://github.com/Dynflow/dynflow.git","ssh_url":"git@github.com:Dynflow/dynflow.git","clone_url":"https://github.com/Dynflow/dynflow.git","svn_url":"https://github.com/Dynflow/dynflow","homepage":"http://dynflow.github.io","size":3225,"stargazers_count":30,"watchers_count":30,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":17,"forks":16,"open_issues":17,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Dynflow/dynflow/pulls/157"},"html":{"href":"https://github.com/Dynflow/dynflow/pull/157"},"issue":{"href":"https://api.github.com/repos/Dynflow/dynflow/issues/157"},"comments":{"href":"https://api.github.com/repos/Dynflow/dynflow/issues/157/comments"},"review_comments":{"href":"https://api.github.com/repos/Dynflow/dynflow/pulls/157/comments"},"review_comment":{"href":"https://api.github.com/repos/Dynflow/dynflow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Dynflow/dynflow/pulls/157/commits"},"statuses":{"href":"https://api.github.com/repos/Dynflow/dynflow/statuses/bc4c3aae3287ac9b78d66c482d5c6abb8e5e0ac4"}}}}