floyd-cli
floyd-cli copied to clipboard
Can commands return raw output instead of table
Can floyd commands return raw JSON output instead of the table ? Can we have an option for this?
floyd info job_id --raw
This sounds useful. Feel free to send a PR!
ok noted. My plan is to add an argument raw
to ExperimentClient
def get(self, id, raw):
response = self.request("GET",
"{}{}".format(self.url, id))
experiment_dict = response.json()
if raw:
return experiment_dict
return Experiment.from_dict(experiment_dict)
And then add options in experiment.py
@click.option('-r', '--raw', is_flag=True, default=False, help='Returns raw JSON response')
def info(id, raw)
experiment = ExperimentClient().get(id, raw)
What do u think?
Thanks for the offer! Can you just change the option as "--format". It can take two values "default" and "json" (default value is "default").
Also, it would be better if the change is in the info method. Once you get the experiment object, you can return the json that by calling a to_dict() method on the expt (this method needs to be added as well).