Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import logging
- import time
- # Configure logging with time
- logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
- logger = logging.getLogger(__name__)
- for i in range(200):
- logger.info(f"Starting subprocess run {i + 1}/200")
- process = subprocess.Popen(
- ['chromium-browser', 'https://example.com/', '--no-sandbox', '--headless',
- f'--screenshot=./pic_test_Xvfb/{i}.jpg', '--window-size=800,700',
- '--disable-gpu', '--virtual-time-budget=1000'],
- shell=False
- )
- process.wait()
- logger.info(f"Completed subprocess run {i + 1}/200")
- if i < 199: # No need to wait after the last run
- logger.info("Waiting for 5 minutes before the next run")
- time.sleep(300) # Wait for 5 minutes (300 seconds)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement