def calculation_outputls(self, *args): """ Show the list of output files of a calculation node. It lists the files in the 'path' subdirectory of the output node of files retrieved by the parser. Therefore, this will not work before files are retrieved by the daemon. Use the -h option for more help on the command line options. """ import argparse from aiida.common.exceptions import NotExistent from aiida.cmdline.commands.node import list_repo_files parser = argparse.ArgumentParser( prog=self.get_full_command_name(), description='List ourput files in the repository folder.') parser.add_argument('calc', metavar='PK', type=int, help='The pk of the calculation') parser.add_argument('-p', '--path', type=str, default='', nargs='?', help="The relative path of the file you " "want to show. If not specified, show content" " of all the 'path' directory") parser.add_argument('-c', '--color', action='store_true', help="Color folders with a different color") args = list(args) parsed_args = parser.parse_args(args) if not is_dbenv_loaded(): load_dbenv() try: calc = load_node(parsed_args.calc) except NotExistent as e: print >> sys.stderr, e.message sys.exit(1) try: parsed_node = calc.out.retrieved except AttributeError: print >> sys.stderr, ("No 'retrieved' node found. Have the " "calculation files already been retrieved?") sys.exit(1) try: list_repo_files(parsed_node, os.path.join('path', parsed_args.path), parsed_args.color) except ValueError as e: print >> sys.stderr, e.message sys.exit(1)
def calculation_inputls(self, *args): """ Show the list of input files of a calculation node. It shows the files in the raw_input subdirectory. Use the -h option for more help on the command line options. """ import argparse from aiida.common.exceptions import NotExistent from aiida.cmdline.commands.node import list_repo_files parser = argparse.ArgumentParser( prog=self.get_full_command_name(), description='List input files in the repository folder.') parser.add_argument('calc', metavar='PK', type=int, help='The pk of the calculation') parser.add_argument('-p', '--path', type=str, default='', nargs='?', help="The relative path of the file you " "want to show. If not specified, show content" " of all the 'raw_input' directory") parser.add_argument('-c', '--color', action='store_true', help="Color folders with a different color") args = list(args) parsed_args = parser.parse_args(args) if not is_dbenv_loaded(): load_dbenv() try: calc = load_node(parsed_args.calc) except NotExistent as e: print >> sys.stderr, e.message sys.exit(1) try: list_repo_files(calc, os.path.join('raw_input', parsed_args.path), parsed_args.color) except ValueError as e: print >> sys.stderr, e.message sys.exit(1)