Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can commands return raw output instead of table #76

Open
rmdort opened this issue Aug 1, 2017 · 3 comments
Open

Can commands return raw output instead of table #76

rmdort opened this issue Aug 1, 2017 · 3 comments

Comments

@rmdort
Copy link
Contributor

rmdort commented Aug 1, 2017

Can floyd commands return raw JSON output instead of the table ? Can we have an option for this?

floyd info job_id --raw

@rmdort rmdort changed the title Commands return raw output instead of table Can commands return raw output instead of table Aug 1, 2017
@narenst
Copy link
Contributor

narenst commented Aug 1, 2017

This sounds useful. Feel free to send a PR!

@rmdort
Copy link
Contributor Author

rmdort commented Aug 1, 2017

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?

@narenst
Copy link
Contributor

narenst commented Aug 1, 2017

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants