Skip to content
Snippets Groups Projects
Forked from DM / dm-docs
261 commits behind, 428 commits ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
getExperimentsCli.py 914 B
#!/usr/bin/env python

from dm.ds_web_service.api.experimentRestApi import ExperimentRestApi
from dsWebServiceSessionCli import DsWebServiceSessionCli

class GetExperimentsCli(DsWebServiceSessionCli):
    def __init__(self):
        DsWebServiceSessionCli.__init__(self)

    def runCommand(self):
        self.parseArgs(usage="""
    dm-get-experiments 

Description:
    Retrieves list of known experiments.
        """)
        api = ExperimentRestApi(self.getLoginUsername(), self.getLoginPassword(), self.getServiceHost(), self.getServicePort(), self.getServiceProtocol())
        experiments = api.getExperiments()
        for experiment in experiments:
            print experiment.getDisplayString(self.getDisplayKeys(), self.getDisplayFormat())


#######################################################################
# Run command.
if __name__ == '__main__':
    cli = GetExperimentsCli()
    cli.run()