{"action":"created","issue":{"url":"https://api.github.com/repos/tethysplatform/tethys/issues/346","repository_url":"https://api.github.com/repos/tethysplatform/tethys","labels_url":"https://api.github.com/repos/tethysplatform/tethys/issues/346/labels{/name}","comments_url":"https://api.github.com/repos/tethysplatform/tethys/issues/346/comments","events_url":"https://api.github.com/repos/tethysplatform/tethys/issues/346/events","html_url":"https://github.com/tethysplatform/tethys/pull/346","id":356124009,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyNDk0MzEz","number":346,"title":"jobs refactor","user":{"login":"sdc50","id":6454472,"node_id":"MDQ6VXNlcjY0NTQ0NzI=","avatar_url":"https://avatars0.githubusercontent.com/u/6454472?v=4","gravatar_id":"","url":"https://api.github.com/users/sdc50","html_url":"https://github.com/sdc50","followers_url":"https://api.github.com/users/sdc50/followers","following_url":"https://api.github.com/users/sdc50/following{/other_user}","gists_url":"https://api.github.com/users/sdc50/gists{/gist_id}","starred_url":"https://api.github.com/users/sdc50/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdc50/subscriptions","organizations_url":"https://api.github.com/users/sdc50/orgs","repos_url":"https://api.github.com/users/sdc50/repos","events_url":"https://api.github.com/users/sdc50/events{/privacy}","received_events_url":"https://api.github.com/users/sdc50/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-31T21:07:34Z","updated_at":"2018-08-31T21:13:22Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/tethysplatform/tethys/pulls/346","html_url":"https://github.com/tethysplatform/tethys/pull/346","diff_url":"https://github.com/tethysplatform/tethys/pull/346.diff","patch_url":"https://github.com/tethysplatform/tethys/pull/346.patch"},"body":"* deprecate job templates\r\n* add ability to create job without template\r\n* fix jobs table bugs\r\n* add ability to dynamically add the id as part of the job name"},"comment":{"url":"https://api.github.com/repos/tethysplatform/tethys/issues/comments/417790682","html_url":"https://github.com/tethysplatform/tethys/pull/346#issuecomment-417790682","issue_url":"https://api.github.com/repos/tethysplatform/tethys/issues/346","id":417790682,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNzc5MDY4Mg==","user":{"login":"sdc50","id":6454472,"node_id":"MDQ6VXNlcjY0NTQ0NzI=","avatar_url":"https://avatars0.githubusercontent.com/u/6454472?v=4","gravatar_id":"","url":"https://api.github.com/users/sdc50","html_url":"https://github.com/sdc50","followers_url":"https://api.github.com/users/sdc50/followers","following_url":"https://api.github.com/users/sdc50/following{/other_user}","gists_url":"https://api.github.com/users/sdc50/gists{/gist_id}","starred_url":"https://api.github.com/users/sdc50/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdc50/subscriptions","organizations_url":"https://api.github.com/users/sdc50/orgs","repos_url":"https://api.github.com/users/sdc50/repos","events_url":"https://api.github.com/users/sdc50/events{/privacy}","received_events_url":"https://api.github.com/users/sdc50/received_events","type":"User","site_admin":false},"created_at":"2018-08-31T21:13:22Z","updated_at":"2018-08-31T21:13:22Z","author_association":"MEMBER","body":"Here is an example of how the jobs api will change:\r\n\r\n### The old way\r\nIn `app.py`:\r\n\r\n```python\r\n    def job_templates(cls):\r\n        \"\"\"\r\n        Example job_templates method.\r\n        \"\"\"\r\n\r\n        my_job_description = CondorJobDescription(condorpy_template_name='vanilla_transfer_files',\r\n                                                  remote_input_files=('$(APP_WORKSPACE)/my_script.py', '$(APP_WORKSPACE)/input_1', '$(USER_WORKSPACE)/input_2'),\r\n                                                  executable='my_script.py',\r\n                                                  transfer_input_files=('../input_1', '../input_2'),\r\n                                                  transfer_output_files=('example_output1', 'example_output2'),\r\n                                                  arguments=['arg1', 'arg2']\r\n                                                  )\r\n\r\n        job_templates = (CondorJobTemplate(name='example',\r\n                                           job_description=my_job_description,\r\n                                           scheduler=None,\r\n                                          ),\r\n                        )\r\n\r\n        return job_templates\r\n```\r\n\r\nIn `controllers.py`:\r\n```python\r\n    job = job_manager.create_job('template_job', request.user, 'example')\r\n    job.save()\r\n```\r\n### The new way\r\nThe `job_templates` method on the app class is now deprecated. All jobs are instantiated and defined in a controller (or helper script). \r\n\r\nIn `controllers.py`:\r\n```python\r\n    app_workspace = app.get_app_workspace().path\r\n    job = job_manager.create_job(\r\n        name='job_{id}',\r\n        user=request.user,\r\n        job_type='CONDOR',\r\n        attributes=dict(attribute1='attr1'),\r\n        condorpy_template_name='vanilla_transfer_files',\r\n        remote_input_files=(\r\n            os.path.join(app_workspace, 'my_script.py'),\r\n            os.path.join(app_workspace, 'input_1'),\r\n            os.path.join(app_workspace, 'input_2')\r\n        )\r\n    )\r\n    # attributes and properties can also be added after the job is created\r\n    job.set_attribute('executable', 'python.py')\r\n    job.extended_properties = {'one': 1, 'two': 2}\r\n    job.save()\r\n```"}}
{"actor":{"display_login":"sdc50"}}