SaiBon99 commited on
Commit
a7faf87
·
1 Parent(s): d228066

Add max_batches parameter to batch URL scanning function for better control over processing

Browse files
.github/workflows/scheduled_data_pipeline.yml CHANGED
@@ -95,5 +95,5 @@ jobs:
95
  --output-fg-name urlscan_features \
96
  --output-version 1 \
97
  --batch-size 500 \
98
- --sample-size 500
99
  timeout-minutes: 30 # Prevent job from running too long
 
95
  --output-fg-name urlscan_features \
96
  --output-version 1 \
97
  --batch-size 500 \
98
+ --max_batches 1
99
  timeout-minutes: 30 # Prevent job from running too long
src/phising_detection/features/batch_url_scanner.py CHANGED
@@ -440,7 +440,8 @@ def main(
440
  output_fg_name: str = "urlscan_features",
441
  output_version: int = 1,
442
  batch_size: int = 200,
443
- sample_size: int = None
 
444
  ):
445
  """
446
  Main orchestration function.
@@ -454,6 +455,7 @@ def main(
454
  output_version: Version of output feature group
455
  batch_size: Number of URLs to scan per batch
456
  sample_size: Number of samples from each input group (None = all)
 
457
  """
458
  logger.info("=" * 80)
459
  logger.info("Starting batch URL scanning pipeline")
@@ -512,6 +514,9 @@ def main(
512
 
513
  # Process in batches
514
  for batch_num in range(total_batches):
 
 
 
515
  start_idx = batch_num * batch_size
516
  end_idx = min(start_idx + batch_size, total_urls)
517
 
 
440
  output_fg_name: str = "urlscan_features",
441
  output_version: int = 1,
442
  batch_size: int = 200,
443
+ sample_size: int = None,
444
+ max_batches: int = None
445
  ):
446
  """
447
  Main orchestration function.
 
455
  output_version: Version of output feature group
456
  batch_size: Number of URLs to scan per batch
457
  sample_size: Number of samples from each input group (None = all)
458
+ max_batches: Maximum number of batches to process (None = all)
459
  """
460
  logger.info("=" * 80)
461
  logger.info("Starting batch URL scanning pipeline")
 
514
 
515
  # Process in batches
516
  for batch_num in range(total_batches):
517
+ if max_batches is not None and batch_num >= max_batches:
518
+ logger.info(f"Reached maximum batch limit of {max_batches}, stopping.")
519
+ break
520
  start_idx = batch_num * batch_size
521
  end_idx = min(start_idx + batch_size, total_urls)
522