Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(17)  |  Call(12)  |  Derive(0)  |  Import(5)

        def to_json(obj, fp=None):
    default = lambda o: o.__json__() if callable(getattr(o, '__json__', None)) else str(o)
    kwargs = dict(default=default, indent=2, sort_keys=True)
    return json.dump(obj, fp, **kwargs) if fp else json.dumps(obj, **kwargs)
        


src/s/b/sbgsdk-0.5.4/sbdk/executor.py   sbgsdk(Download)
from sbgsdk.job import Job
from sbgsdk.exceptions import JobException
from sbgsdk.protocol import from_json, to_json
from sbgsdk.executor import Executor
 
    def execute(self, job, one_container=False):
        logging.info('Job started: %s' % job.job_id)
        logging.debug('Job: %s' % to_json(job))
 
        if one_container:
        if isinstance(result, Job):
            return self.execute(result)
        logging.info('Job finished: %s' % to_json(job))
        return result
 
        with open('__in__.json', 'w') as fp:
            logging.debug('Writing job order to %s', os.path.abspath('__in__.json'))
            to_json(job, fp)
        self.runner.run_wrapper('__in__.json',
                                cwd=job_dir)
        with open(in_file, 'w') as fp:
            logging.debug('Writing job order to %s', in_file)
            to_json(job, fp)
        self.runner.run_job('__in__.json', '__out__.json', cwd=job_dir)
        with open(out_file) as fp:

src/s/b/sbgsdk-0.5.4/sbgsdk/cli.py   sbgsdk(Download)
from sbgsdk.errors import INTERNAL_ERROR
from sbgsdk.exceptions import exit_code_for_exception, NotAJobError, ValidationException, JobException, ProtocolException
from sbgsdk.protocol import from_json, to_json
from sbgsdk.job import Job
from sbgsdk.util import import_name
def cmd_schema(output, **kwargs):
    sch = get_wrapper_schemas(kwargs.pop('package', None))
    if output:
        with open(output, 'w') as fp:
            to_json(sch, fp)
    else:
        print(to_json(sch))
 
    with open(output, 'w') as fp:
        to_json(result, fp)
 
 

src/s/b/sbgsdk-0.5.4/sbdk/commands/run.py   sbgsdk(Download)
import json
 
from sbgsdk.job import Job
from sbdk.executor import Adun
from sbgsdk.protocol import to_json
        if output:
            with open(output, 'w') as fp:
                to_json(result, fp)
        else:
            print(to_json(result))

src/s/b/sbgsdk-0.5.4/sbgsdk/executor.py   sbgsdk(Download)
from sbgsdk.job import BaseJob, Job, Outputs
from sbgsdk.util import import_name
from sbgsdk.protocol import to_json
 
 
    def execute(self, job):
        logging.debug('Job started: %s' % to_json(job))
        if job.job_id in self.results:
            return self.results[job.job_id]
        for key, val in job.args.iteritems():
        if isinstance(result, BaseJob):
            return self.execute(result)
        logging.debug('Job result: %s' % to_json(result))
        return result
 

src/s/b/sbgsdk-0.5.4/sbgsdk/tests/test_wrappers/red_adder_test.py   sbgsdk(Download)
import filecmp
from sbgsdk.job import Job
from sbgsdk.protocol import from_json, to_json
from sbgsdk.executor import Tassadar
from sbgsdk.tests.test_tools.generator import generator
 
    job_multi = Job(RedAdder, inputs=inputs, params={'n': 5})
    Tassadar().execute(from_json(to_json(job_multi)))
 
    assert filecmp.cmp('output_parallel.txt', 'output_single.txt')