Skip to content

OSC as a Module

Junyi, Lu edited this page Feb 3, 2017 · 3 revisions

The main logic of OSC is totally separate from CLI, which means you can deeply integrate this logic into your infrastructure if you have your own scheduling system or something like that.

Integrate payload into your python infrastructure

Consider osc/commands/copy.py as one of your internal python script, then it's a great example for how to use the OSC logic directly without executing CLI commands.

Let's say you have a Python job scheduler in your company's code base, and you want to schedule an OSC job now. Just put something below to initialize an OSC run.

def job_handler(self, args):
    self.payload = CopyPayload(**args)
    self.payload.run()

Apparently, we can do much more than that. Possibly make some arguments sanity check, or configure some customized hook for OSC as explained in Use Hooks