def cli(job_id, follow, tail):
    job = get_job(job_id)
    for item in job_resource_iter(job,
                                  job.requests,
                                  output_json=True,
                                  follow=follow,
                                  tail=tail):
        click.echo(item)
Example #2
0
    def test_get_job(self, mock_HSC):
        class MockJob(object):
            metadata = {'some': 'val'}
        mockjob = MockJob()
        mock_HSC.return_value.get_job.return_value = mockjob
        conf = mock_conf(self)

        self.assertIs(utils.get_job('1/1/1'), mockjob)
        mock_HSC.assert_called_once_with(auth=conf.apikeys['default'])

        with self.assertRaises(BadParameterException):
            utils.get_job('1/1/')

        # Non-existent job
        mockjob.metadata = None
        with self.assertRaises(NotFoundException):
            utils.get_job('1/1/1')
Example #3
0
    def test_get_job(self, mock_HSC):
        class MockJob(object):
            metadata = {'some': 'val'}
        mockjob = MockJob()
        mock_HSC.return_value.get_job.return_value = mockjob
        conf = mock_conf(self)

        self.assertIs(utils.get_job('1/1/1'), mockjob)
        mock_HSC.assert_called_once_with(auth=conf.apikeys['default'])

        with self.assertRaises(BadParameterException):
            utils.get_job('1/1/')

        # Non-existent job
        mockjob.metadata = None
        with self.assertRaises(NotFoundException):
            utils.get_job('1/1/1')
Example #4
0
File: log.py Project: cans/shub
def cli(job_id, follow):
    job = get_job(job_id)
    for item in job_resource_iter(job,
                                  job.logs.iter_values,
                                  follow=follow,
                                  key_func=lambda item: item['_key']):
        click.echo("{} {} {}".format(
            datetime.utcfromtimestamp(item['time'] / 1000),
            logging.getLevelName(int(item['level'])), item['message']))
Example #5
0
def cli(job_id, follow, tail):
    job = get_job(job_id)
    for item in job_resource_iter(job, job.logs, follow=follow, tail=tail):
        click.echo(
            u"{} {} {}".format(
                datetime.utcfromtimestamp(item['time']/1000),
                logging.getLevelName(int(item['level'])),
                item['message']
            )
        )
Example #6
0
def cli(job_id, follow, tail):
    job = get_job(job_id)
    for item in job_resource_iter(job, job.logs, follow=follow, tail=tail):
        click.echo(
            u"{} {} {}".format(
                datetime.utcfromtimestamp(item['time']/1000),
                logging.getLevelName(int(item['level'])),
                item['message']
            )
        )
Example #7
0
File: log.py Project: cans/shub
def cli(job_id, follow):
    job = get_job(job_id)
    for item in job_resource_iter(job, job.logs.iter_values, follow=follow,
                                  key_func=lambda item: item['_key']):
        click.echo(
            "{} {} {}".format(
                datetime.utcfromtimestamp(item['time']/1000),
                logging.getLevelName(int(item['level'])),
                item['message']
            )
        )
Example #8
0
def cli(job_id, follow):
    job = get_job(job_id)
    for item in job_resource_iter(job, job.items.iter_json, follow=follow):
        click.echo(item)
Example #9
0
def cli(job_id, follow, tail):
    job = get_job(job_id)
    for item in job_resource_iter(job, job.requests, output_json=True,
                                  follow=follow, tail=tail):
        click.echo(item)
Example #10
0
def cli(job_id, follow):
    job = get_job(job_id)
    for item in job_resource_iter(job, job.requests.iter_json, follow=follow):
        click.echo(item)