How to use install_component method in localstack

Best Python code snippet using localstack_python

launcher.py

Source:launcher.py Github

copy

Full Screen

...55 print(datahandling.get_connection_info())56 if args.info:57 show_info()58 elif args.install:59 install_component()60 elif args.sample_id is not None:61 run_sample(args)62def show_info():63 """64 Shows information about the component65 """66 message: str = (67 f"Component: {COMPONENT['name']}\n"68 f"Version: {COMPONENT['version']}\n"69 f"Details: {json.dumps(COMPONENT['details'], indent=4)}\n"70 f"Requirements: {json.dumps(COMPONENT['requirements'], indent=4)}\n"71 f"Output files: {json.dumps(COMPONENT['db_values_changes']['files'], indent=4)}\n"72 )73 print(message)74def install_component():75 component: list[dict] = datahandling.get_components(component_names=[COMPONENT['name']])76 # if len(component) == 1:77 # print(f"Component has already been installed")78 if len(component) > 1:79 print(f"Component exists multiple times in DB, please contact an admin to fix this in order to proceed")80 else:81 #HACK: Installs based on your current directory currently. Should be changed to the directory your docker/singularity file is82 #HACK: Removed install check so you can reinstall the component. Should do this in a nicer way83 COMPONENT['install']['path'] = os.path.os.getcwd()84 datahandling.post_component(COMPONENT)85 component: list[dict] = datahandling.get_components(component_names=[COMPONENT['name']])86 if len(component) != 1:87 print(f"Error with installation of {COMPONENT['name']} {len(component)}\n")88 exit()89def run_sample(args: object):90 """91 Runs sample ID through snakemake pipeline92 """93 if not os.path.isdir(args.outdir):94 os.makedirs(args.outdir)95 os.chdir(args.outdir)96 sample: list[dict] = datahandling.get_samples(sample_ids=[args.sample_id])97 component: list[dict] = datahandling.get_components(component_names=[COMPONENT['name']])98 if len(component) == 0:99 print(f"component not found in DB, would you like to install it (Y/N)?:")100 install_component()101 if len(sample) == 0:102 # Invalid sample id103 print(f"sample_id not found in DB")104 pass105 elif len(sample) != 1:106 print(f"Error with sample_id")107 elif len(component) != 1:108 print(f"Error with component_id")109 else:110 print(f"snakemake -s /bifrost_{COMPONENT['display_name']}/bifrost_{COMPONENT['display_name']}/pipeline.smk --config sample_id={str(sample[0]['_id'])} component_id={str(component[0]['_id'])}")111 try:112 process: subprocess.Popen = subprocess.Popen(113 f"snakemake -s /bifrost_{COMPONENT['display_name']}/bifrost_{COMPONENT['display_name']}/pipeline.smk --config sample_id={str(sample[0]['_id'])} component_id={str(component[0]['_id'])}",114 stdout=sys.stdout,...

Full Screen

Full Screen

setmeup.py

Source:setmeup.py Github

copy

Full Screen

1import os, platform, json, subprocess2from common_res.clc_tools import ColorPrint, get_distro, get_version, get_architecture3resdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'setmeup_res')4logname = 'setmeup_LOG.log'5with open(os.path.join(resdir, 'install_scripts_index.json'), 'r') as data_f, open(logname, 'w') as log_f:6 install_data = json.load(data_f)7 uname = platform.uname()8 this_distro = get_distro(uname)9 this_version = get_version(uname)10 this_arch = get_architecture(uname)11 os_id = None12 for osid in install_data['supported_os']:13 if osid['distro'] == this_distro and osid['version'] == this_version and osid['arch'] == this_arch:14 os_id = osid['id']15 break16 if os_id is None:17 ColorPrint.Fail('Current system %s - %s - %s not supported, sorry! =/' % (this_distro, this_version, this_arch))18 exit()19 ColorPrint.Bold('Components to be installed (Green = available):\n')20 install_components = list()21 for command_group in install_data['command_groups']:22 install_component = dict()23 install_component['name'] = command_group['name']24 install_component['active'] = False25 install_component['components'] = list()26 print('<%s>' % command_group['name'])27 for component in command_group['components']:28 script_id = '-'29 for script_info_set in component['script_info']:30 for script_os in script_info_set['os']:31 if script_os['id'] == os_id:32 script_id = script_info_set['script_id']33 install_component['active'] = True34 break35 if not script_id == '-':36 break37 script_item = dict()38 script_item['name'] = component['name']39 script_item['script'] = os.path.join(resdir, 'scripts', command_group['code'], '%s-%s.sh' % (component['code'], script_id))40 script_item['active'] = (not script_id == '-')41 install_component['components'].append(script_item)42 if script_item['active']:43 ColorPrint.Green(' * %s' % script_item['name'])44 else:45 ColorPrint.Fail(' * %s' % script_item['name'])46 if install_component['active']:47 install_components.append(install_component)48 print()49 user_ack = input('Is this acceptable? [y]n: ')50 if not (user_ack.lower() == 'y' or user_ack == ''):51 print('Very well. Not proceeding.')52 exit()53 print('Proceeding...')54 print()55 for install_component in install_components:56 print('<%s>' % install_component['name'])57 components = [component for component in install_component['components'] if component['active']]58 for script in components:59 print(' * %s ... ' % script['name'], end='')60 try:61 n = len(script['script'])62 log_f.write('\n%s\n%s\n%s\n' % ('-'*n, script['script'], '='*n))63 output = subprocess.check_output([script['script']], stdin=subprocess.DEVNULL, stderr=log_f)64 log_f.write(output.decode("utf-8"))65 ColorPrint.Green('Success.')66 except subprocess.CalledProcessError as e:67 log_f.write(e.output.decode("utf-8"))68 ColorPrint.Fail('Failed.')69 print('Install script outputs written to logfile: ', end='')70 ColorPrint.Bold(logname)71 ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful