Best Python code snippet using yandex-tank
sfdelete.py
Source:sfdelete.py
...16def get_ids():17 print('creating bulk select job')18 job = bulk.create_query_job(object_type, contentType='CSV')19 batch = bulk.query(job,query)20 bulk.close_job(job)21 print('waiting for batch')22 while not bulk.is_batch_done(batch):23 print('.',end='')24 sys.stdout.flush()25 sleep(0.5)26 ids = []27 for result in bulk.get_all_results_for_query_batch(batch):28 reader = unicodecsv.DictReader(result, encoding='utf-8')29 for row in reader:30 ids.append(row['Id'])31 return ids32def del_ids(ids):33 print('creating bulk delete jobs')34 batchsize = 1000035 count = len(ids)36 batches = math.ceil(count/batchsize)37 remaining = count38 for batch in range(batches):39 print('batch %d of %d starting' % (batch+1, batches))40 batchsize = min(batchsize,remaining)41 batchstart = batch*batchsize42 job = bulk.create_delete_job(object_type, contentType='CSV')43 ids_dict = [dict(Id=idx) for idx in ids[batchstart:batchstart+batchsize]]44 print(ids_dict)45 csv_iter = CsvDictsAdapter(iter(ids_dict))46 batch = bulk.post_batch(job, csv_iter)47 bulk.close_job(job)48 print('waiting for batch')49 while not bulk.is_batch_done(batch):50 print('.',end='')51 sys.stdout.flush()52 sleep(0.5)53 for result in bulk.get_batch_results(batch):54 print(result)55def query_yes_no(question, default="no"):56 valid = {"yes": True, "y": True, "ye": True,57 "no": False, "n": False}58 if default is None:59 prompt = " [y/n] "60 elif default == "yes":61 prompt = " [Y/n] "...
urls.py
Source:urls.py
1from django.urls import re_path, include, path2from . import views3urlpatterns = [4 path('', views.jobs_list, name='jobs'),5 path('create_job/', views.create_job, name='create_job'),6 path('save_job/', views.save_job, name='save_job'),7 path('create_interview/', views.create_interview, name='create_interview'),8 path('save_interview/', views.save_interview, name='save_interview'),9 path('candidate_invitation/', views.candidate_invitation, name='candidate_invitation'),10 path('applicant_list/', views.applicant_list, name="applicant_list"),11 path('close_job/', views.close_job, name='close_job'),12 path('archive_job/', views.archive_job, name='archive_job'),13 path('ajax/get_interviewers/', views.get_interviewers, name='get_interviewers'),14 path('edit_job/', views.edit_job, name='edit_job')...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!