Advertisement
Daidalos117

Untitled

Apr 6th, 2025
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. import subprocess
  2. import logging
  3. import time
  4.  
  5. # Configure logging with time
  6. logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
  7. logger = logging.getLogger(__name__)
  8.  
  9. for i in range(200):
  10.     logger.info(f"Starting subprocess run {i + 1}/200")
  11.     process = subprocess.Popen(
  12.         ['chromium-browser', 'https://example.com/', '--no-sandbox', '--headless',
  13.          f'--screenshot=./pic_test_Xvfb/{i}.jpg', '--window-size=800,700',
  14.          '--disable-gpu', '--virtual-time-budget=1000'],
  15.         shell=False
  16.     )
  17.     process.wait()
  18.     logger.info(f"Completed subprocess run {i + 1}/200")
  19.     if i < 199:  # No need to wait after the last run
  20.         logger.info("Waiting for 5 minutes before the next run")
  21.         time.sleep(300)  # Wait for 5 minutes (300 seconds)
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement