{"action":"created","comment":{"url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls/comments/38847423","id":38847423,"diff_hunk":"@@ -0,0 +1,85 @@\n+# -*- coding: utf-8 -*-\n+#\n+# This file is part of Invenio.\n+# Copyright (C) 2015 CERN.\n+#\n+# Invenio is free software; you can redistribute it and/or\n+# modify it under the terms of the GNU General Public License as\n+# published by the Free Software Foundation; either version 2 of the\n+# License, or (at your option) any later version.\n+#\n+# Invenio is distributed in the hope that it will be useful, but\n+# WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+# General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with Invenio; if not, write to the Free Software Foundation, Inc.,\n+# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.\n+\n+\"\"\"Perform operations with workflows.\"\"\"\n+\n+from __future__ import print_function\n+\n+import argparse\n+import sys\n+\n+from flask import current_app\n+\n+from invenio.ext.script import Manager\n+\n+import six\n+\n+from werkzeug.utils import import_string\n+\n+from .api import (\n+    start as start_workflow,\n+    start_delayed\n+)\n+\n+manager = Manager(description=__doc__)\n+\n+\n+def split_marcxml(source):\n+    \"\"\"Split a MARCXML file using dojson MARC21 utils.\"\"\"\n+    from dojson.contrib.marc21.utils import split_blob\n+    return [data for data in split_blob(source.read())]\n+\n+\n+@manager.option('source', type=argparse.FileType('r'), default=sys.stdin,\n+                help=\"Input file (defaults to STDIN).\", nargs='?')\n+@manager.option('name', help=\"Name of workflow to start.\")\n+@manager.option('-t', '--input-type', dest='input_type', default='json',\n+                help=\"Format of input file.\")\n+@manager.option('--delayed', dest='delayed', action='store_true',\n+                help=\"Run workflows asynchronously.\")\n+def start(name, source, input_type='json', delayed=False):\n+    \"\"\"Run given workflow with data from file.\"\"\"\n+    processor = current_app.config['WORKFLOWS_DATA_PROCESSORS'][input_type]\n+    if isinstance(processor, six.string_types):\n+        processor = import_string(processor)\n+    if delayed:\n+        start_delayed(name, processor(source))\n+    else:\n+        start_workflow(name, processor(source))\n+\n+\n+@manager.command\n+def list():\n+    \"\"\"List available workflows.\"\"\"\n+    from invenio_workflows.registry import workflows\n+\n+    print(\"Available workflows:\")","path":"invenio_workflows/manage.py","position":null,"original_position":72,"commit_id":"694f7ec2c74d51a71e23ebbc7d3072989b98e9d8","original_commit_id":"bc0f9d111edac8bac06b956c2bc82dd141924d29","user":{"login":"jirikuncar","id":189798,"avatar_url":"https://avatars.githubusercontent.com/u/189798?v=3","gravatar_id":"","url":"https://api.github.com/users/jirikuncar","html_url":"https://github.com/jirikuncar","followers_url":"https://api.github.com/users/jirikuncar/followers","following_url":"https://api.github.com/users/jirikuncar/following{/other_user}","gists_url":"https://api.github.com/users/jirikuncar/gists{/gist_id}","starred_url":"https://api.github.com/users/jirikuncar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jirikuncar/subscriptions","organizations_url":"https://api.github.com/users/jirikuncar/orgs","repos_url":"https://api.github.com/users/jirikuncar/repos","events_url":"https://api.github.com/users/jirikuncar/events{/privacy}","received_events_url":"https://api.github.com/users/jirikuncar/received_events","type":"User","site_admin":false},"body":"What about something similar to `inveniomanage show-urls`\r\n\r\n`name\\tpkg_name` -> `oaiharvest_record\\tinvenio_oaiharvester.workflows.oaiharvest_record`?","created_at":"2015-09-07T09:37:06Z","updated_at":"2015-09-07T09:37:06Z","html_url":"https://github.com/inveniosoftware/invenio-workflows/pull/12#discussion_r38847423","pull_request_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls/comments/38847423"},"html":{"href":"https://github.com/inveniosoftware/invenio-workflows/pull/12#discussion_r38847423"},"pull_request":{"href":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls/12","id":44106513,"html_url":"https://github.com/inveniosoftware/invenio-workflows/pull/12","diff_url":"https://github.com/inveniosoftware/invenio-workflows/pull/12.diff","patch_url":"https://github.com/inveniosoftware/invenio-workflows/pull/12.patch","issue_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/issues/12","number":12,"state":"open","locked":false,"title":"manage: initial manager","user":{"login":"jalavik","id":633680,"avatar_url":"https://avatars.githubusercontent.com/u/633680?v=3","gravatar_id":"","url":"https://api.github.com/users/jalavik","html_url":"https://github.com/jalavik","followers_url":"https://api.github.com/users/jalavik/followers","following_url":"https://api.github.com/users/jalavik/following{/other_user}","gists_url":"https://api.github.com/users/jalavik/gists{/gist_id}","starred_url":"https://api.github.com/users/jalavik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jalavik/subscriptions","organizations_url":"https://api.github.com/users/jalavik/orgs","repos_url":"https://api.github.com/users/jalavik/repos","events_url":"https://api.github.com/users/jalavik/events{/privacy}","received_events_url":"https://api.github.com/users/jalavik/received_events","type":"User","site_admin":false},"body":"* BETTER Adds a simplistic manager to easily start workflows\r\n  with data from files.\r\n\r\n* Adds new config option `WORKFLOWS_DATA_PROCESSORS` which allows\r\n  to map input formats to functions to allow pre-processing of\r\n  data from the files.\r\n\r\nSigned-off-by: Jan Aage Lavik <jan.age.lavik@cern.ch>","created_at":"2015-09-03T13:29:18Z","updated_at":"2015-09-07T09:37:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bbb8ac8302d412124ccb36269536638f07fe78ef","assignee":{"login":"jalavik","id":633680,"avatar_url":"https://avatars.githubusercontent.com/u/633680?v=3","gravatar_id":"","url":"https://api.github.com/users/jalavik","html_url":"https://github.com/jalavik","followers_url":"https://api.github.com/users/jalavik/followers","following_url":"https://api.github.com/users/jalavik/following{/other_user}","gists_url":"https://api.github.com/users/jalavik/gists{/gist_id}","starred_url":"https://api.github.com/users/jalavik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jalavik/subscriptions","organizations_url":"https://api.github.com/users/jalavik/orgs","repos_url":"https://api.github.com/users/jalavik/repos","events_url":"https://api.github.com/users/jalavik/events{/privacy}","received_events_url":"https://api.github.com/users/jalavik/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/milestones/2","html_url":"https://github.com/inveniosoftware/invenio-workflows/milestones/v0.2.0","labels_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/milestones/2/labels","id":1253481,"number":2,"title":"v0.2.0","description":"","creator":{"login":"jirikuncar","id":189798,"avatar_url":"https://avatars.githubusercontent.com/u/189798?v=3","gravatar_id":"","url":"https://api.github.com/users/jirikuncar","html_url":"https://github.com/jirikuncar","followers_url":"https://api.github.com/users/jirikuncar/followers","following_url":"https://api.github.com/users/jirikuncar/following{/other_user}","gists_url":"https://api.github.com/users/jirikuncar/gists{/gist_id}","starred_url":"https://api.github.com/users/jirikuncar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jirikuncar/subscriptions","organizations_url":"https://api.github.com/users/jirikuncar/orgs","repos_url":"https://api.github.com/users/jirikuncar/repos","events_url":"https://api.github.com/users/jirikuncar/events{/privacy}","received_events_url":"https://api.github.com/users/jirikuncar/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":1,"state":"open","created_at":"2015-08-13T11:43:31Z","updated_at":"2015-09-06T17:30:58Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls/12/commits","review_comments_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls/12/comments","review_comment_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls/comments{/number}","comments_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/issues/12/comments","statuses_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/statuses/694f7ec2c74d51a71e23ebbc7d3072989b98e9d8","head":{"label":"jalavik:workflows-manager","ref":"workflows-manager","sha":"694f7ec2c74d51a71e23ebbc7d3072989b98e9d8","user":{"login":"jalavik","id":633680,"avatar_url":"https://avatars.githubusercontent.com/u/633680?v=3","gravatar_id":"","url":"https://api.github.com/users/jalavik","html_url":"https://github.com/jalavik","followers_url":"https://api.github.com/users/jalavik/followers","following_url":"https://api.github.com/users/jalavik/following{/other_user}","gists_url":"https://api.github.com/users/jalavik/gists{/gist_id}","starred_url":"https://api.github.com/users/jalavik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jalavik/subscriptions","organizations_url":"https://api.github.com/users/jalavik/orgs","repos_url":"https://api.github.com/users/jalavik/repos","events_url":"https://api.github.com/users/jalavik/events{/privacy}","received_events_url":"https://api.github.com/users/jalavik/received_events","type":"User","site_admin":false},"repo":{"id":40650578,"name":"invenio-workflows","full_name":"jalavik/invenio-workflows","owner":{"login":"jalavik","id":633680,"avatar_url":"https://avatars.githubusercontent.com/u/633680?v=3","gravatar_id":"","url":"https://api.github.com/users/jalavik","html_url":"https://github.com/jalavik","followers_url":"https://api.github.com/users/jalavik/followers","following_url":"https://api.github.com/users/jalavik/following{/other_user}","gists_url":"https://api.github.com/users/jalavik/gists{/gist_id}","starred_url":"https://api.github.com/users/jalavik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jalavik/subscriptions","organizations_url":"https://api.github.com/users/jalavik/orgs","repos_url":"https://api.github.com/users/jalavik/repos","events_url":"https://api.github.com/users/jalavik/events{/privacy}","received_events_url":"https://api.github.com/users/jalavik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jalavik/invenio-workflows","description":"Invenio module for running determined set of tasks.","fork":true,"url":"https://api.github.com/repos/jalavik/invenio-workflows","forks_url":"https://api.github.com/repos/jalavik/invenio-workflows/forks","keys_url":"https://api.github.com/repos/jalavik/invenio-workflows/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jalavik/invenio-workflows/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jalavik/invenio-workflows/teams","hooks_url":"https://api.github.com/repos/jalavik/invenio-workflows/hooks","issue_events_url":"https://api.github.com/repos/jalavik/invenio-workflows/issues/events{/number}","events_url":"https://api.github.com/repos/jalavik/invenio-workflows/events","assignees_url":"https://api.github.com/repos/jalavik/invenio-workflows/assignees{/user}","branches_url":"https://api.github.com/repos/jalavik/invenio-workflows/branches{/branch}","tags_url":"https://api.github.com/repos/jalavik/invenio-workflows/tags","blobs_url":"https://api.github.com/repos/jalavik/invenio-workflows/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jalavik/invenio-workflows/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jalavik/invenio-workflows/git/refs{/sha}","trees_url":"https://api.github.com/repos/jalavik/invenio-workflows/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jalavik/invenio-workflows/statuses/{sha}","languages_url":"https://api.github.com/repos/jalavik/invenio-workflows/languages","stargazers_url":"https://api.github.com/repos/jalavik/invenio-workflows/stargazers","contributors_url":"https://api.github.com/repos/jalavik/invenio-workflows/contributors","subscribers_url":"https://api.github.com/repos/jalavik/invenio-workflows/subscribers","subscription_url":"https://api.github.com/repos/jalavik/invenio-workflows/subscription","commits_url":"https://api.github.com/repos/jalavik/invenio-workflows/commits{/sha}","git_commits_url":"https://api.github.com/repos/jalavik/invenio-workflows/git/commits{/sha}","comments_url":"https://api.github.com/repos/jalavik/invenio-workflows/comments{/number}","issue_comment_url":"https://api.github.com/repos/jalavik/invenio-workflows/issues/comments{/number}","contents_url":"https://api.github.com/repos/jalavik/invenio-workflows/contents/{+path}","compare_url":"https://api.github.com/repos/jalavik/invenio-workflows/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jalavik/invenio-workflows/merges","archive_url":"https://api.github.com/repos/jalavik/invenio-workflows/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jalavik/invenio-workflows/downloads","issues_url":"https://api.github.com/repos/jalavik/invenio-workflows/issues{/number}","pulls_url":"https://api.github.com/repos/jalavik/invenio-workflows/pulls{/number}","milestones_url":"https://api.github.com/repos/jalavik/invenio-workflows/milestones{/number}","notifications_url":"https://api.github.com/repos/jalavik/invenio-workflows/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jalavik/invenio-workflows/labels{/name}","releases_url":"https://api.github.com/repos/jalavik/invenio-workflows/releases{/id}","created_at":"2015-08-13T09:31:06Z","updated_at":"2015-08-13T09:31:06Z","pushed_at":"2015-09-07T09:34:31Z","git_url":"git://github.com/jalavik/invenio-workflows.git","ssh_url":"git@github.com:jalavik/invenio-workflows.git","clone_url":"https://github.com/jalavik/invenio-workflows.git","svn_url":"https://github.com/jalavik/invenio-workflows","homepage":"","size":1474,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"inveniosoftware:master","ref":"master","sha":"5aeb8fe3a711438fa0503cfbf801a22181543e07","user":{"login":"inveniosoftware","id":1157480,"avatar_url":"https://avatars.githubusercontent.com/u/1157480?v=3","gravatar_id":"","url":"https://api.github.com/users/inveniosoftware","html_url":"https://github.com/inveniosoftware","followers_url":"https://api.github.com/users/inveniosoftware/followers","following_url":"https://api.github.com/users/inveniosoftware/following{/other_user}","gists_url":"https://api.github.com/users/inveniosoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/inveniosoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inveniosoftware/subscriptions","organizations_url":"https://api.github.com/users/inveniosoftware/orgs","repos_url":"https://api.github.com/users/inveniosoftware/repos","events_url":"https://api.github.com/users/inveniosoftware/events{/privacy}","received_events_url":"https://api.github.com/users/inveniosoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":40605992,"name":"invenio-workflows","full_name":"inveniosoftware/invenio-workflows","owner":{"login":"inveniosoftware","id":1157480,"avatar_url":"https://avatars.githubusercontent.com/u/1157480?v=3","gravatar_id":"","url":"https://api.github.com/users/inveniosoftware","html_url":"https://github.com/inveniosoftware","followers_url":"https://api.github.com/users/inveniosoftware/followers","following_url":"https://api.github.com/users/inveniosoftware/following{/other_user}","gists_url":"https://api.github.com/users/inveniosoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/inveniosoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inveniosoftware/subscriptions","organizations_url":"https://api.github.com/users/inveniosoftware/orgs","repos_url":"https://api.github.com/users/inveniosoftware/repos","events_url":"https://api.github.com/users/inveniosoftware/events{/privacy}","received_events_url":"https://api.github.com/users/inveniosoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inveniosoftware/invenio-workflows","description":"Invenio module for running determined set of tasks.","fork":false,"url":"https://api.github.com/repos/inveniosoftware/invenio-workflows","forks_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/forks","keys_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/teams","hooks_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/hooks","issue_events_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/issues/events{/number}","events_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/events","assignees_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/assignees{/user}","branches_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/branches{/branch}","tags_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/tags","blobs_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/git/refs{/sha}","trees_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/statuses/{sha}","languages_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/languages","stargazers_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/stargazers","contributors_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/contributors","subscribers_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/subscribers","subscription_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/subscription","commits_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/commits{/sha}","git_commits_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/git/commits{/sha}","comments_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/comments{/number}","issue_comment_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/issues/comments{/number}","contents_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/contents/{+path}","compare_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/merges","archive_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/downloads","issues_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/issues{/number}","pulls_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls{/number}","milestones_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/milestones{/number}","notifications_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/labels{/name}","releases_url":"https://api.github.com/repos/inveniosoftware/invenio-workflows/releases{/id}","created_at":"2015-08-12T14:44:21Z","updated_at":"2015-08-19T12:50:24Z","pushed_at":"2015-09-07T09:34:32Z","git_url":"git://github.com/inveniosoftware/invenio-workflows.git","ssh_url":"git@github.com:inveniosoftware/invenio-workflows.git","clone_url":"https://github.com/inveniosoftware/invenio-workflows.git","svn_url":"https://github.com/inveniosoftware/invenio-workflows","homepage":"","size":1646,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":3,"forks":8,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls/12"},"html":{"href":"https://github.com/inveniosoftware/invenio-workflows/pull/12"},"issue":{"href":"https://api.github.com/repos/inveniosoftware/invenio-workflows/issues/12"},"comments":{"href":"https://api.github.com/repos/inveniosoftware/invenio-workflows/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/inveniosoftware/invenio-workflows/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/inveniosoftware/invenio-workflows/statuses/694f7ec2c74d51a71e23ebbc7d3072989b98e9d8"}}}}