{"action":"created","issue":{"url":"https://api.github.com/repos/c-rack/quantum-elixir/issues/43","labels_url":"https://api.github.com/repos/c-rack/quantum-elixir/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/c-rack/quantum-elixir/issues/43/comments","events_url":"https://api.github.com/repos/c-rack/quantum-elixir/issues/43/events","html_url":"https://github.com/c-rack/quantum-elixir/issues/43","id":115997451,"number":43,"title":"Problem: normalize_unnamed_job throws exception w/ argument","user":{"login":"theoretick","id":1449707,"avatar_url":"https://avatars.githubusercontent.com/u/1449707?v=3","gravatar_id":"","url":"https://api.github.com/users/theoretick","html_url":"https://github.com/theoretick","followers_url":"https://api.github.com/users/theoretick/followers","following_url":"https://api.github.com/users/theoretick/following{/other_user}","gists_url":"https://api.github.com/users/theoretick/gists{/gist_id}","starred_url":"https://api.github.com/users/theoretick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theoretick/subscriptions","organizations_url":"https://api.github.com/users/theoretick/orgs","repos_url":"https://api.github.com/users/theoretick/repos","events_url":"https://api.github.com/users/theoretick/events{/privacy}","received_events_url":"https://api.github.com/users/theoretick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-10T00:16:43Z","updated_at":"2015-11-10T14:43:08Z","closed_at":null,"body":"I just discovered a bug in v0.5.0 where [`Quantum.Normalizer.normalize_unnamed_job`](https://github.com/c-rack/quantum-elixir/blob/master/lib/quantum/normalizer.ex#L68) is not properly handling jobs that take arguments. Reproduction:\r\n\r\n```elixir\r\niex(2)> [\"* * * * * Kernel.node\"] |> Enum.map(&Quantum.Normalizer.normalize/1)\r\n[nil: %Quantum.Job{args: [], name: nil, nodes: [:nonode@nohost],\r\n  schedule: \"* * * * *\", state: :active, task: {\"Kernel\", \"node\"}}]\r\n\r\niex(3)> [\"* * * * * Kernel.node(self)\"] |> Enum.map(&Quantum.Normalizer.normalize/1)\r\n** (MatchError) no match of right hand side value: []\r\n    (quantum) lib/quantum/normalizer.ex:68: Quantum.Normalizer.normalize_unnamed_job/1\r\n    (quantum) lib/quantum/normalizer.ex:50: Quantum.Normalizer.normalize_job/1\r\n    (quantum) lib/quantum/normalizer.ex:6: Quantum.Normalizer.normalize/1\r\n     (elixir) lib/enum.ex:1043: anonymous fn/3 in Enum.map/2\r\n     (elixir) lib/enum.ex:1387: Enum.\"-reduce/3-lists^foldl/2-0-\"/3\r\n     (elixir) lib/enum.ex:1043: Enum.map/2\r\n```\r\n\r\nSorry for the convoluted execution job, I had to find a STDLIB method that optionally took an argument to make this easily reproducible, hence `node`.\r\n\r\n---\r\n**Edit:** In looking through the usage examples there is appears to be few cases of argument passing except the use of `args` w/ named jobs.\r\n\r\nIt'll require a bit of a refactor as I dont see an easy way to enable argument passing here (fix regex, pass opts to `normalize_task`, etc etc) so maybe it should just be made clear its a limitation within the readme?  Not sure how you would like to proceed."},"comment":{"url":"https://api.github.com/repos/c-rack/quantum-elixir/issues/comments/155438165","html_url":"https://github.com/c-rack/quantum-elixir/issues/43#issuecomment-155438165","issue_url":"https://api.github.com/repos/c-rack/quantum-elixir/issues/43","id":155438165,"user":{"login":"c-rack","id":169184,"avatar_url":"https://avatars.githubusercontent.com/u/169184?v=3","gravatar_id":"","url":"https://api.github.com/users/c-rack","html_url":"https://github.com/c-rack","followers_url":"https://api.github.com/users/c-rack/followers","following_url":"https://api.github.com/users/c-rack/following{/other_user}","gists_url":"https://api.github.com/users/c-rack/gists{/gist_id}","starred_url":"https://api.github.com/users/c-rack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c-rack/subscriptions","organizations_url":"https://api.github.com/users/c-rack/orgs","repos_url":"https://api.github.com/users/c-rack/repos","events_url":"https://api.github.com/users/c-rack/events{/privacy}","received_events_url":"https://api.github.com/users/c-rack/received_events","type":"User","site_admin":false},"created_at":"2015-11-10T14:43:08Z","updated_at":"2015-11-10T14:43:08Z","body":"@theoretick Thanks for reporting!\r\nOur documentation should be improved on this point. PRs are welcome.\r\n\r\nAnd if someone wants to implement support for @alPacino's idea `\"* * * * *\": {MyApp.MyModule, :my_method, [1, 2, 3]}`, PRs are welcome, too :-)"}}