mirror of
https://github.com/clearml/clearml-agent
synced 2025-06-23 02:05:43 +00:00
Remove deprecated command
This commit is contained in:
parent
d2c5e127b8
commit
5e6a809efd
@ -20,7 +20,7 @@ from .interface import get_parser
|
|||||||
def run_command(parser, args, command_name):
|
def run_command(parser, args, command_name):
|
||||||
|
|
||||||
debug = args.debug
|
debug = args.debug
|
||||||
if command_name and command_name.lower() == 'config':
|
if command_name and command_name.lower() in ('config', 'init'):
|
||||||
command_class = commands.Config
|
command_class = commands.Config
|
||||||
elif len(command_name.split('.')) < 2:
|
elif len(command_name.split('.')) < 2:
|
||||||
command_class = commands.Worker
|
command_class = commands.Worker
|
||||||
@ -76,25 +76,7 @@ def main():
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
parser.error(argparse._('too few arguments'))
|
parser.error(argparse._('too few arguments'))
|
||||||
|
|
||||||
if not args.trace:
|
return run_command(parser, args, command_name)
|
||||||
return run_command(parser, args, command_name)
|
|
||||||
|
|
||||||
with named_temporary_file(
|
|
||||||
mode='w',
|
|
||||||
buffering=FileBuffering.LINE_BUFFERING,
|
|
||||||
prefix='.trains_agent_trace_',
|
|
||||||
suffix='.txt',
|
|
||||||
delete=False,
|
|
||||||
) as output:
|
|
||||||
print(
|
|
||||||
'Saving trace for command '
|
|
||||||
'"{definitions.PROGRAM_NAME} {command_name} {args.func}" to "{output.name}"'.format(
|
|
||||||
**chain_map(locals(), globals())))
|
|
||||||
tracer = PackageTrace(
|
|
||||||
package=trains_agent,
|
|
||||||
out_file=output,
|
|
||||||
ignore_submodules=(__name__, interface, definitions, session))
|
|
||||||
return tracer.runfunc(run_command, parser, args, command_name)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -9,6 +9,11 @@ class Config(ServiceCommandSection):
|
|||||||
def config(self, **_):
|
def config(self, **_):
|
||||||
return self._session.print_configuration()
|
return self._session.print_configuration()
|
||||||
|
|
||||||
|
def init(self, **_):
|
||||||
|
# alias config init
|
||||||
|
from .config import main
|
||||||
|
return main()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def service(self):
|
def service(self):
|
||||||
""" The name of the REST service used by this command """
|
""" The name of the REST service used by this command """
|
||||||
|
@ -557,15 +557,6 @@ class Worker(ServiceCommandSection):
|
|||||||
)
|
)
|
||||||
self.dump_config()
|
self.dump_config()
|
||||||
|
|
||||||
def init(self, **_):
|
|
||||||
# alias config init
|
|
||||||
from .config import main
|
|
||||||
return main()
|
|
||||||
|
|
||||||
def config(self, **_):
|
|
||||||
# alias for check
|
|
||||||
return self.check()
|
|
||||||
|
|
||||||
def check(self, **_):
|
def check(self, **_):
|
||||||
try:
|
try:
|
||||||
check_directory_path(str(Path(".").resolve()))
|
check_directory_path(str(Path(".").resolve()))
|
||||||
@ -609,18 +600,17 @@ class Worker(ServiceCommandSection):
|
|||||||
if not queues:
|
if not queues:
|
||||||
default_queue = self._session.send_api(queues_api.GetDefaultRequest())
|
default_queue = self._session.send_api(queues_api.GetDefaultRequest())
|
||||||
queues = [default_queue.id]
|
queues = [default_queue.id]
|
||||||
print('Listening to default queue "{0.name}" ({0.id})'.format(default_queue))
|
|
||||||
else:
|
queues = return_list(queues)
|
||||||
queues = return_list(queues)
|
queues_info = [
|
||||||
queues_info = [
|
self._session.send_api(
|
||||||
self._session.send_api(
|
queues_api.GetByIdRequest(queue)
|
||||||
queues_api.GetByIdRequest(queue)
|
).queue.to_dict()
|
||||||
).queue.to_dict()
|
for queue in queues
|
||||||
for queue in queues
|
]
|
||||||
]
|
columns = ("id", "name", "tags")
|
||||||
columns = ("id", "name", "tags")
|
print("Listening to queues:")
|
||||||
print("Listening to queues:")
|
print_table(queues_info, columns=columns, titles=columns)
|
||||||
print_table(queues_info, columns=columns, titles=columns)
|
|
||||||
|
|
||||||
# register worker
|
# register worker
|
||||||
self._register(queues)
|
self._register(queues)
|
||||||
|
@ -295,8 +295,6 @@ class WorkerParams(object):
|
|||||||
global_args = ("--config-file", str(self.config_file))
|
global_args = ("--config-file", str(self.config_file))
|
||||||
if self.debug:
|
if self.debug:
|
||||||
global_args += ("--debug",)
|
global_args += ("--debug",)
|
||||||
if self.trace:
|
|
||||||
global_args += ("--trace",)
|
|
||||||
worker_args = tuple()
|
worker_args = tuple()
|
||||||
if self.optimization:
|
if self.optimization:
|
||||||
worker_args += self.get_optimization_flag()
|
worker_args += self.get_optimization_flag()
|
||||||
|
@ -374,11 +374,6 @@ def base_arguments(top_parser):
|
|||||||
'--config-file',
|
'--config-file',
|
||||||
help='Use a different configuration file (default: "{}")'.format(definitions.CONFIG_FILE))
|
help='Use a different configuration file (default: "{}")'.format(definitions.CONFIG_FILE))
|
||||||
top_parser.add_argument('--debug', '-d', action='store_true', help='print debug information')
|
top_parser.add_argument('--debug', '-d', action='store_true', help='print debug information')
|
||||||
top_parser.add_argument(
|
|
||||||
'--trace', '-t',
|
|
||||||
action='store_true',
|
|
||||||
help='Trace execution to a temporary file.',
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def bound_number_type(minimum=None, maximum=None):
|
def bound_number_type(minimum=None, maximum=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user