How to use get_client_logs method in autotest

Best Python code snippet using autotest_python

__init__.py

Source:__init__.py Github

copy

Full Screen

1from pyramid.config import Configurator2from pyramid.renderers import JSONP3from sqlalchemy import engine_from_config4from pyramid.session import SignedCookieSessionFactory5from .models import (6 DBSession,7 Base,8 )9from config import system_config10import os11print os.path.dirname(os.path.realpath(__file__))12def main(global_config, **settings):13 """ This function returns a Pyramid WSGI application.14 """15 engine = engine_from_config(settings, 'sqlalchemy.')16 DBSession.configure(bind=engine)17 Base.metadata.bind = engine18 config = Configurator(settings=settings)19 config.include('pyramid_chameleon')20 my_session_factory = SignedCookieSessionFactory('max_secret_yellr_password')21 config.set_session_factory(my_session_factory)22 #config.add_renderer('jsonp', JSONP(param_name='callback'))23 #config.add_route('json_test', 'json_test')24 config.add_static_view('static', 'static', cache_max_age=3600)25 config.add_static_view('moderator','moderator')26 # decode upload dir based on relative path or not27 if system_config['upload_dir'][0] == '/':28 media_path = system_config['upload_dir']29 else:30 media_path = '../{0}'.format(system_config['upload_dir'])31 config.add_static_view(name='media', path=media_path)32 # template views33 #config.add_route('index', '/')34 #config.add_route('submit-tip.html','submit-tip.html')35 #config.add_route('/', '/')36 config.add_route('index', '/')37 config.add_route('robots', 'robots.txt')38 config.add_route('/local','/local')39 config.add_route('/assignments', '/assignments')40 config.add_route('/view', '/view')41 config.add_route('/stories', '/stories')42 config.add_route('/post', '/post')43 # admin views44 config.add_route('admin/get_access_token.json', 'admin/get_access_token.json')45 config.add_route('admin/get_client_logs.json', 'admin/get_client_logs.json')46 config.add_route('admin/get_posts.json', 'admin/get_posts.json')47 config.add_route('admin/create_question.json', 'admin/create_question.json')48 config.add_route('admin/update_question.json', 'admin/update_question.json')49 config.add_route('admin/publish_assignment.json', 'admin/publish_assignment.json')50 config.add_route('admin/update_assignment.json', 'admin/update_assignment.json')51 config.add_route('admin/get_assignments.json', 'admin/get_assignments.json')52 config.add_route('admin/create_message.json', 'admin/create_message.json')53 config.add_route('admin/get_my_messages.json', 'admin/get_my_messages.json')54 config.add_route('admin/get_languages.json', 'admin/get_languages.json')55 config.add_route('admin/get_question_types.json', 'admin/get_question_types.json')56 config.add_route('admin/create_user2.json', 'admin/create_user2.json')57 config.add_route('admin/get_assignment_responses.json', \58 'admin/get_assignment_responses.json')59 config.add_route('admin/register_post_view.json','admin/register_post_view.json')60 config.add_route('admin/publish_story.json', 'admin/publish_story.json')61 config.add_route('admin/get_my_collections.json', 'admin/get_my_collections.json')62 config.add_route('admin/create_collection.json', 'admin/create_collection.json')63 config.add_route('admin/add_post_to_collection.json', 'admin/add_post_to_collection.json')64 config.add_route('admin/remove_post_from_collection.json', 'admin/remove_post_from_collection.json')65 config.add_route('admin/disable_collection.json', 'admin/disable_collection.json')66 config.add_route('admin/get_collection_posts.json', 'admin/get_collection_posts.json')67 config.add_route('admin/get_client_posts.json','admin/get_client_posts.json')68 config.add_route('admin/get_subscriber_list.json','admin/get_subscriber_list.json')69 config.add_route('admin/create_user.json','admin/create_user.json')70 config.add_route('admin/get_post.json', 'admin/get_post.json')71 config.add_route('admin/delete_post.json', 'admin/delete_post.json')72 config.add_route('admin/get_organizations.json', 'admin/get_organizations.json')73 config.add_route('admin/add_organization.json', 'admin/add_organization.json')74 config.add_route('admin/check_logged_in.json', 'admin/check_logged_in.json')75 config.add_route('admin/logout.json', 'admin/logout.json')76 config.add_route('admin/change_password.json', 'admin/change_password.json')77 config.add_route('admin/approve_post.json','admin/approve_post.json')78 # client views79 #config.add_route('server_info.json','server_info.json')80 config.add_route('zipcode_lookup.json','zipcode_lookup.json')81 config.add_route('get_data.json', 'get_data.json')82 config.add_route('create_response_message.json', \83 'create_response_message.json')84 config.add_route('get_assignments.json','get_assignments.json')85 config.add_route('get_messages.json','get_messages.json')86 config.add_route('get_notifications.json','get_notifications.json')87 #config.add_route('get_posts.json','get_posts.json')88 config.add_route('get_stories.json', 'get_stories.json')89 config.add_route('upload_media.json','upload_media.json')90 config.add_route('upload_test.json','upload_test.json')91 config.add_route('publish_post.json','publish_post.json')92 config.add_route('get_profile.json', 'get_profile.json')93 #config.add_route('verify_client.json', 'verify_client.json')94 config.add_route('get_local_posts.json', 'get_local_posts.json')95 config.add_route('register_vote.json', 'register_vote.json')96 config.scan()...

Full Screen

Full Screen

run_logs_analysis.py

Source:run_logs_analysis.py Github

copy

Full Screen

1# Copyright 2012 Viewfinder Inc. All Rights Reserved.2"""Run logs analysis jobs that depend on each other while holding the job:logs_analysis lock.3We can't import those modules as too many global variables would conflict (flags, process name etc...).4Sequentially run jobs that depend on each other. Sets of jobs are:5Server logs pipeline:6 - viewfinder.backend.logs.get_server_logs7 - viewfinder.backend.logs.analyze_merged_logs8 - viewfinder.backend.logs.server_log_metrics9Client analytics logs pipeline:10 - viewfinder.backend.logs.get_client_logs11 - viewfinder.backend.logs.analyze_analytics_logs12Each job set grabs its own lock to prevent the same job set from being run on another instance.13"""14__author__ = 'marc@emailscrubbed.com (Marc Berhault)'15import logging16import sys17import time18import traceback19from tornado import gen, ioloop, options, process20from viewfinder.backend.base import main21from viewfinder.backend.db import db_client22from viewfinder.backend.db.job import Job23# The jobs are run serially and in the order listed for each key.24# Dictionary of 'job set name' to list of jobs. Each job consists of a tuple ('job name', list of args).25kJobSets = {26 'server_logs_analysis': [27 ('get_server_logs', ['python', '-m', 'viewfinder.backend.logs.get_server_logs',28 '--dry_run=False', '--require_lock=True' ]),29 ('analyze_merged_logs', ['python', '-m', 'viewfinder.backend.logs.analyze_merged_logs',30 '--dry_run=False', '--require_lock=True',31 '--smart_scan=True', '--hours_between_runs=6']),32 ('server_log_metrics', ['python', '-m', 'viewfinder.backend.logs.server_log_metrics',33 '--dry_run=False', '--require_lock=True',34 '--smart_scan=True', '--hours_between_runs=6']),35 ],36 'client_logs_analysis': [37 ('get_client_logs', ['python', '-m', 'viewfinder.backend.logs.get_client_logs',38 '--dry_run=False', '--require_lock=True' ]),39 ('analyze_analytics_logs', ['python', '-m', 'viewfinder.backend.logs.analyze_analytics_logs',40 '--dry_run=False', '--require_lock=True',41 '--smart_scan=True', '--hours_between_runs=6']),42 ]43}44options.define('job_set', default='server_logs_analysis', help='Job set to run. One of %r.' % kJobSets.keys())45@gen.engine46def _Run(callback):47 """Grab the lock and run all commands an subprocesess."""48 job_set = options.options.job_set49 assert job_set in kJobSets.keys(), '--job_set must be one of %r' % kJobSets.keys()50 jobs = kJobSets[job_set]51 client = db_client.DBClient.Instance()52 job = Job(client, job_set)53 got_lock = yield gen.Task(job.AcquireLock)54 if not got_lock:55 logging.warning('Failed to acquire job lock: exiting.')56 callback()57 return58 # Wrap entire call inside a try to make sure we always release the lock.59 try:60 for title, args in jobs:61 logging.info('[%s] running %s' % (title, ' '.join(args)))62 # Run the task and wait for the termination callback.63 proc = process.Subprocess(args, io_loop=ioloop.IOLoop.instance())64 code = yield gen.Task(proc.set_exit_callback)65 logging.info('[%s] finished with code: %r' % (title, code))66 except:67 logging.error(traceback.format_exc())68 finally:69 yield gen.Task(job.ReleaseLock)70 callback()71if __name__ == '__main__':...

Full Screen

Full Screen

roku_cmd_grabber.py

Source:roku_cmd_grabber.py Github

copy

Full Screen

1import telnetlib2def get_client_Logs(ip):3 '''open telnet session and retrieve the current loaded texture info, return string '''4 print("Setup Telnet Session")5 tn = telnetlib.Telnet(ip,'8085')6 tn.read_until(b"Running ",timeout=30)7 print("Getting Logs")8 stuff = tn.read_until(b"stop", timeout=90)9 print(stuff)10 tn.close()11 return stuff12def get_command_from_logs(ip):13 '''open telnet session and retrieve the current loaded texture info, return string '''14 print("Setup Telnet Session")15 stop = True16 commands = []17 tn = telnetlib.Telnet(ip,'8085')18 print("Restart the app to start grabbing commands")19 tn.read_until(b"Running ",timeout=30)20 while stop:21 tn.read_until(b"Sending ",timeout=30)22 command = tn.read_until(b" over", timeout=90)23 if b"data" in command:24 continue25 else:26 cmd_strip = command.strip(b" over")27 commands.append(cmd_strip)28 print(cmd_strip)29 if b"stop" in command:30 stop = False31 tn.close()32 return commands33stuff = get_command_from_logs("10.100.88.90")...

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 autotest 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