{"action":"created","issue":{"url":"https://api.github.com/repos/PrefectHQ/prefect/issues/1140","repository_url":"https://api.github.com/repos/PrefectHQ/prefect","labels_url":"https://api.github.com/repos/PrefectHQ/prefect/issues/1140/labels{/name}","comments_url":"https://api.github.com/repos/PrefectHQ/prefect/issues/1140/comments","events_url":"https://api.github.com/repos/PrefectHQ/prefect/issues/1140/events","html_url":"https://github.com/PrefectHQ/prefect/issues/1140","id":455718015,"node_id":"MDU6SXNzdWU0NTU3MTgwMTU=","number":1140,"title":"state_handlers return Resume state can not bypass manual_only trigger","user":{"login":"occoder","id":1981057,"node_id":"MDQ6VXNlcjE5ODEwNTc=","avatar_url":"https://avatars0.githubusercontent.com/u/1981057?v=4","gravatar_id":"","url":"https://api.github.com/users/occoder","html_url":"https://github.com/occoder","followers_url":"https://api.github.com/users/occoder/followers","following_url":"https://api.github.com/users/occoder/following{/other_user}","gists_url":"https://api.github.com/users/occoder/gists{/gist_id}","starred_url":"https://api.github.com/users/occoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/occoder/subscriptions","organizations_url":"https://api.github.com/users/occoder/orgs","repos_url":"https://api.github.com/users/occoder/repos","events_url":"https://api.github.com/users/occoder/events{/privacy}","received_events_url":"https://api.github.com/users/occoder/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2019-06-13T12:40:24Z","updated_at":"2019-06-14T03:49:22Z","closed_at":"2019-06-14T01:58:40Z","author_association":"NONE","body":"I use following code to generate a task chain. Each task enters into Paused state through manual_only trigger by default. Once entering the Paused state, its state_handlers return the Resume state right away meaning the task is not blocked by manual_only anymore and continue to run to finish.\r\n```\r\nfrom prefect import Flow, Task\r\nimport datetime\r\nfrom prefect.triggers import manual_only\r\nfrom prefect.engine import state\r\n\r\n\r\nclass TaskFactory(Task):\r\n    def __init__(self, *args, **kwargs):\r\n        super().__init__(*args, **kwargs)\r\n\r\n    def run(self):\r\n        print('This is just a demo.')\r\n\r\n\r\ndef polling_on_pause(task, old_state, new_state):\r\n    if isinstance(new_state, state.Paused):\r\n        print('hello from inside polling_on_pause.')\r\n    return state.Resume()\r\n\r\n\r\nflow = Flow('demo_flow')\r\ntasks_in_sequence = []\r\nfor _ in range(3):\r\n    current_task = TaskFactory(name='demo_task', max_retries=5, retry_delay=datetime.timedelta(seconds=1),\r\n                               trigger=manual_only, state_handlers=[polling_on_pause])\r\n    flow.add_task(current_task)\r\n    tasks_in_sequence.append(current_task)\r\n\r\nflow.chain(*tasks_in_sequence)\r\n\r\nflow.run()\r\n```\r\nBut the console log is as follows:\r\n```\r\n[2019-06-13 12:30:08,965] INFO - prefect.FlowRunner | Beginning Flow run for 'demo_flow'\r\n[2019-06-13 12:30:08,965] INFO - prefect.FlowRunner | Starting flow run.\r\nhello from inside polling_on_pause.\r\n[2019-06-13 12:30:08,970] INFO - prefect.TaskRunner | Task 'demo_task': Starting task run...\r\n[2019-06-13 12:30:08,970] INFO - prefect.TaskRunner | Task 'demo_task': finished task run for task with final state: 'Resume'\r\n[2019-06-13 12:30:08,971] INFO - prefect.TaskRunner | Task 'demo_task': Starting task run...\r\n[2019-06-13 12:30:08,971] INFO - prefect.TaskRunner | Task 'demo_task': finished task run for task with final state: 'Pending'\r\n[2019-06-13 12:30:08,971] INFO - prefect.TaskRunner | Task 'demo_task': Starting task run...\r\n[2019-06-13 12:30:08,971] INFO - prefect.TaskRunner | Task 'demo_task': finished task run for task with final state: 'Pending'\r\n[2019-06-13 12:30:08,973] INFO - prefect.FlowRunner | Flow run RUNNING: terminal tasks are incomplete.\r\n[2019-06-13 12:30:08,973] INFO - prefect.FlowRunner | Beginning Flow run for 'demo_flow'\r\n[2019-06-13 12:30:08,977] INFO - prefect.TaskRunner | Task 'demo_task': Starting task run...\r\n[2019-06-13 12:30:08,978] INFO - prefect.TaskRunner | Task 'demo_task': finished task run for task with final state: 'Resume'\r\n[2019-06-13 12:30:08,978] INFO - prefect.TaskRunner | Task 'demo_task': Starting task run...\r\n[2019-06-13 12:30:08,978] INFO - prefect.TaskRunner | Task 'demo_task': finished task run for task with final state: 'Pending'\r\n[2019-06-13 12:30:08,979] INFO - prefect.TaskRunner | Task 'demo_task': Starting task run...\r\n[2019-06-13 12:30:08,979] INFO - prefect.TaskRunner | Task 'demo_task': finished task run for task with final state: 'Pending'\r\n[2019-06-13 12:30:08,979] INFO - prefect.FlowRunner | Flow run RUNNING: terminal tasks are incomplete.\r\n[2019-06-13 12:30:08,980] INFO - prefect.FlowRunner | Beginning Flow run for 'demo_flow'\r\n[2019-06-13 12:30:08,984] INFO - prefect.TaskRunner | Task 'demo_task': Starting task run...\r\n```\r\nAlthough the first task entered the Resume state, it persisted and never actually ran.\r\nDid I do anything wrong? Or the Resume state in this case simply failed to bypass manual_only trigger?"},"comment":{"url":"https://api.github.com/repos/PrefectHQ/prefect/issues/comments/501957671","html_url":"https://github.com/PrefectHQ/prefect/issues/1140#issuecomment-501957671","issue_url":"https://api.github.com/repos/PrefectHQ/prefect/issues/1140","id":501957671,"node_id":"MDEyOklzc3VlQ29tbWVudDUwMTk1NzY3MQ==","user":{"login":"occoder","id":1981057,"node_id":"MDQ6VXNlcjE5ODEwNTc=","avatar_url":"https://avatars0.githubusercontent.com/u/1981057?v=4","gravatar_id":"","url":"https://api.github.com/users/occoder","html_url":"https://github.com/occoder","followers_url":"https://api.github.com/users/occoder/followers","following_url":"https://api.github.com/users/occoder/following{/other_user}","gists_url":"https://api.github.com/users/occoder/gists{/gist_id}","starred_url":"https://api.github.com/users/occoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/occoder/subscriptions","organizations_url":"https://api.github.com/users/occoder/orgs","repos_url":"https://api.github.com/users/occoder/repos","events_url":"https://api.github.com/users/occoder/events{/privacy}","received_events_url":"https://api.github.com/users/occoder/received_events","type":"User","site_admin":false},"created_at":"2019-06-14T03:49:22Z","updated_at":"2019-06-14T03:49:22Z","author_association":"NONE","body":"Hi @cicdw Sorry to follow this up again.\r\nI forgot to mention that my environment is windows 10.\r\nI did the same change on two different win10 computers. One worked but the other didn't.\r\nThis is quite strange. But I was not able to config the logging level to DEBUG within win10 whatsoever.\r\nI saw there is a notice in the guide saying \"The configuration file is parsed when Prefect is first imported and is available as a live object in prefect.config. \"\r\nSo I tried to set prefect.config.logging.level = 'DEBUG' before flow starts to run in my script. But still failed."}}
{"actor":{"display_login":"occoder"}}