mirror of
https://github.com/clearml/clearml-agent
synced 2025-03-03 02:32:17 +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):
|
||||
|
||||
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
|
||||
elif len(command_name.split('.')) < 2:
|
||||
command_class = commands.Worker
|
||||
@ -76,25 +76,7 @@ def main():
|
||||
except AttributeError:
|
||||
parser.error(argparse._('too few arguments'))
|
||||
|
||||
if not args.trace:
|
||||
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)
|
||||
return run_command(parser, args, command_name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -9,6 +9,11 @@ class Config(ServiceCommandSection):
|
||||
def config(self, **_):
|
||||
return self._session.print_configuration()
|
||||
|
||||
def init(self, **_):
|
||||
# alias config init
|
||||
from .config import main
|
||||
return main()
|
||||
|
||||
@property
|
||||
def service(self):
|
||||
""" The name of the REST service used by this command """
|
||||
|
@ -557,15 +557,6 @@ class Worker(ServiceCommandSection):
|
||||
)
|
||||
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, **_):
|
||||
try:
|
||||
check_directory_path(str(Path(".").resolve()))
|
||||
@ -609,18 +600,17 @@ class Worker(ServiceCommandSection):
|
||||
if not queues:
|
||||
default_queue = self._session.send_api(queues_api.GetDefaultRequest())
|
||||
queues = [default_queue.id]
|
||||
print('Listening to default queue "{0.name}" ({0.id})'.format(default_queue))
|
||||
else:
|
||||
queues = return_list(queues)
|
||||
queues_info = [
|
||||
self._session.send_api(
|
||||
queues_api.GetByIdRequest(queue)
|
||||
).queue.to_dict()
|
||||
for queue in queues
|
||||
]
|
||||
columns = ("id", "name", "tags")
|
||||
print("Listening to queues:")
|
||||
print_table(queues_info, columns=columns, titles=columns)
|
||||
|
||||
queues = return_list(queues)
|
||||
queues_info = [
|
||||
self._session.send_api(
|
||||
queues_api.GetByIdRequest(queue)
|
||||
).queue.to_dict()
|
||||
for queue in queues
|
||||
]
|
||||
columns = ("id", "name", "tags")
|
||||
print("Listening to queues:")
|
||||
print_table(queues_info, columns=columns, titles=columns)
|
||||
|
||||
# register worker
|
||||
self._register(queues)
|
||||
|
@ -295,8 +295,6 @@ class WorkerParams(object):
|
||||
global_args = ("--config-file", str(self.config_file))
|
||||
if self.debug:
|
||||
global_args += ("--debug",)
|
||||
if self.trace:
|
||||
global_args += ("--trace",)
|
||||
worker_args = tuple()
|
||||
if self.optimization:
|
||||
worker_args += self.get_optimization_flag()
|
||||
|
@ -374,11 +374,6 @@ def base_arguments(top_parser):
|
||||
'--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(
|
||||
'--trace', '-t',
|
||||
action='store_true',
|
||||
help='Trace execution to a temporary file.',
|
||||
)
|
||||
|
||||
|
||||
def bound_number_type(minimum=None, maximum=None):
|
||||
|
Loading…
Reference in New Issue
Block a user