Forked from
DM / dm-docs
261 commits behind, 663 commits ahead of the upstream repository.
-
sveseli authored
added stop-upload command; removed un-needed file stats; improved daq/upload reporting; cleaned up un-needed keys from catalog plugin
sveseli authoredadded stop-upload command; removed un-needed file stats; improved daq/upload reporting; cleaned up un-needed keys from catalog plugin
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
stopUploadCli.py 1.22 KiB
#!/usr/bin/env python
from daqWebServiceSessionCli import DaqWebServiceSessionCli
from dm.daq_web_service.api.experimentRestApi import ExperimentRestApi
from dm.common.exceptions.invalidRequest import InvalidRequest
class StopUploadCli(DaqWebServiceSessionCli):
def __init__(self):
DaqWebServiceSessionCli.__init__(self, validArgCount=self.ANY_NUMBER_OF_POSITIONAL_ARGS)
self.addOption('', '--id', dest='id', help='Upload id.')
def checkArgs(self):
if self.options.id is None:
raise InvalidRequest('Upload id must be provided.')
def getId(self):
return self.options.id
def runCommand(self):
self.parseArgs(usage="""
dm-stop-upload --id=ID
Description:
Aborts specified data upload.
""")
self.checkArgs()
api = ExperimentRestApi(self.getLoginUsername(), self.getLoginPassword(), self.getServiceHost(), self.getServicePort(), self.getServiceProtocol())
uploadInfo = api.stopUpload(self.getId())
print uploadInfo.getDisplayString(self.getDisplayKeys(), self.getDisplayFormat())
#######################################################################
# Run command.
if __name__ == '__main__':
cli = StopUploadCli()
cli.run()