def main(argv): experiment.name('custom-actions') container.run( './example-application.sh', # Application invocation. preaction=pre_action, # Set pre-action callback function. postaction=post_action # Set post-action callback function. )
def main(argv): # Name the experiment. experiment.name('test-shellcmds') fname = 'afile.txt' logger.log('# Testing globbing...') shargs = {'echo': True} # Wildcards don't need to be escaped with a `\' or quoted to protect them # from expansion by the host. We take care of that for you. container.run('ls *') # host and container interfaces should behave as identically as possible. host.run('ls *', **shargs) logger.emlog('# Testing redirection...') logger.log(F'# Adding text to {fname}:') host.run(F'echo "Some Text" | tee {fname}', **shargs) host.run(F'echo "More \'Text\'" >> {fname}', **shargs) logger.emlog(F'# The contents of {fname} are:') host.run(F'cat {fname}', **shargs) logger.emlog('# Testing quoting...') container.run('echo "Some \'Text\'"') logger.emlog('# Testing command chaining...') container.run('true && echo true!') container.run('false || echo false is good && echo true is good') logger.emlog('# Testing variable lifetimes within chained commands...') container.run('export FOO="bar" && ' 'test ! -z $FOO && ' 'echo "Looks good!" || ' 'exit 1') metadata.add_asset(metadata.FileAsset(fname))
def main(argv): experiment.name('hello-container') container.run('echo "hello from a container!"') host.run('echo "hello from the host!"')
def main(argv): # Name the experiment. experiment.name('test-shellcmds') fname = 'afile.txt' logger.log('# Testing globbing...') shargs = {'echo': True} # Wildcards need to be escaped with a `\' or quoted to protect them from # expansion by the host. container.run('ls \\*') # shell and container interfaces should behave as identically as possible. host.run('ls \\*', **shargs) logger.emlog('# Testing redirection...') logger.log(F'# Adding text to {fname}:') container.run(F'echo "Some Text" | tee {fname}') container.run(F'echo "More \'Text\'" >> {fname}') logger.emlog(F'# The contents of {fname} are:') host.run(F'cat {fname}', **shargs) logger.emlog('# Testing quoting...') container.run('echo "Some \'Text\'"') logger.emlog('# Testing command chaining...') container.run('true && echo true!') container.run('false || echo false... && echo and done!') metadata.add_asset(metadata.FileAsset(fname))