import sys, json
from sci.session import Session
from sci.bootstrap import Bootstrap

data = json.loads(sys.stdin.read())

session_id = sys.argv[1]
session = Session.load(session_id)

run_info = data['run_info']
Bootstrap.run(session, data['build_id'], data['job_server'],
              run_info['step_fun'], args = run_info['args'],
              kwargs = run_info['kwargs'], env = run_info['env'])

import sys, json
from sci.session import Session
from sci.bootstrap import Bootstrap

data = json.loads(sys.stdin.read())

session_id = sys.argv[1]
session = Session.load(session_id)

run_info = data['run_info'] or {}

Bootstrap.run(session, data['build_id'], data['job_server'],
              run_info.get('step_fun'),
              args = run_info.get('args', []),
              kwargs = run_info.get('kwargs', {}),
              env = run_info.get('env'))

Support when run_info is not specified
Support when run_info is not specified

That is the case when starting a build (not running a step)

  import sys, json
  from sci.session import Session
  from sci.bootstrap import Bootstrap
  
  data = json.loads(sys.stdin.read())
  
  session_id = sys.argv[1]
  session = Session.load(session_id)
  
- run_info = data['run_info']
+ run_info = data['run_info'] or {}
+ 
  Bootstrap.run(session, data['build_id'], data['job_server'],
-               run_info['step_fun'], args = run_info['args'],
-               kwargs = run_info['kwargs'], env = run_info['env'])
+               run_info.get('step_fun'),
+               args = run_info.get('args', []),
+               kwargs = run_info.get('kwargs', {}),
+               env = run_info.get('env'))
  
Support when run_info is not specified
## Code Before:
import sys, json
from sci.session import Session
from sci.bootstrap import Bootstrap

data = json.loads(sys.stdin.read())

session_id = sys.argv[1]
session = Session.load(session_id)

run_info = data['run_info']
Bootstrap.run(session, data['build_id'], data['job_server'],
              run_info['step_fun'], args = run_info['args'],
              kwargs = run_info['kwargs'], env = run_info['env'])

## Instruction:
Support when run_info is not specified
## Code After:
import sys, json
from sci.session import Session
from sci.bootstrap import Bootstrap

data = json.loads(sys.stdin.read())

session_id = sys.argv[1]
session = Session.load(session_id)

run_info = data['run_info'] or {}

Bootstrap.run(session, data['build_id'], data['job_server'],
              run_info.get('step_fun'),
              args = run_info.get('args', []),
              kwargs = run_info.get('kwargs', {}),
              env = run_info.get('env'))
