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)
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')
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']))
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'] ) )
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'] ) )
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)
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)