From 76d118c708ab1952f633d66a931a239c1f4f8252 Mon Sep 17 00:00:00 2001 From: danleifeng Date: Mon, 8 Jan 2024 15:53:54 +0800 Subject: [PATCH 1/3] fix fleetutil get_online_pass_interval bug3; test=develop --- .../incubate/distributed/fleet/fleet_util.py | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/python/paddle/incubate/distributed/fleet/fleet_util.py b/python/paddle/incubate/distributed/fleet/fleet_util.py index e0450948e6171..657c43ecf953e 100644 --- a/python/paddle/incubate/distributed/fleet/fleet_util.py +++ b/python/paddle/incubate/distributed/fleet/fleet_util.py @@ -20,6 +20,7 @@ import os import sys import time +import re import numpy as np @@ -1317,25 +1318,12 @@ def get_online_pass_interval( ... is_data_hourly_placed=False) """ - assert ( - "|" not in days - and ";" not in days - and "\\" not in days - and "/" not in days - and "(" not in days - and ")" not in days - and "&" not in days - ), r"days should not contain [|,;,\,/,(,),&]" + pattern = r'^\d+|{[0-9]+}|{[0-9]+\.\.[0-9]+}$' + if not re.fullmatch(pattern, str(days)): + raise Exception("days format is not right") days = os.popen("echo -n " + days).read().split(" ") - assert ( - "|" not in hours - and ";" not in hours - and "\\" not in hours - and "/" not in hours - and "(" not in hours - and ")" not in hours - and "&" not in hours - ), r"hours should not contain [|,;,\,/,(,),&]" + if not re.fullmatch(pattern, str(hours)): + raise Exception("hours format is not right") hours = os.popen("echo -n " + hours).read().split(" ") split_interval = int(split_interval) split_per_pass = int(split_per_pass) From f7ecf2f8115aa49a4f2323b071c0662d03b61893 Mon Sep 17 00:00:00 2001 From: danleifeng Date: Mon, 8 Jan 2024 16:21:27 +0800 Subject: [PATCH 2/3] fix fleetutil get_online_pass_interval bug3; test=develop --- python/paddle/incubate/distributed/fleet/fleet_util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/paddle/incubate/distributed/fleet/fleet_util.py b/python/paddle/incubate/distributed/fleet/fleet_util.py index 657c43ecf953e..82a07a77801f1 100644 --- a/python/paddle/incubate/distributed/fleet/fleet_util.py +++ b/python/paddle/incubate/distributed/fleet/fleet_util.py @@ -1320,10 +1320,10 @@ def get_online_pass_interval( """ pattern = r'^\d+|{[0-9]+}|{[0-9]+\.\.[0-9]+}$' if not re.fullmatch(pattern, str(days)): - raise Exception("days format is not right") + raise Exception("days format is not right") days = os.popen("echo -n " + days).read().split(" ") if not re.fullmatch(pattern, str(hours)): - raise Exception("hours format is not right") + raise Exception("hours format is not right") hours = os.popen("echo -n " + hours).read().split(" ") split_interval = int(split_interval) split_per_pass = int(split_per_pass) From b126c6322059151b8484518826ad143534d8af3c Mon Sep 17 00:00:00 2001 From: danleifeng Date: Mon, 8 Jan 2024 16:49:42 +0800 Subject: [PATCH 3/3] fix fleetutil get_online_pass_interval bug3; test=develop --- python/paddle/incubate/distributed/fleet/fleet_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/incubate/distributed/fleet/fleet_util.py b/python/paddle/incubate/distributed/fleet/fleet_util.py index 82a07a77801f1..9af91e4f5b148 100644 --- a/python/paddle/incubate/distributed/fleet/fleet_util.py +++ b/python/paddle/incubate/distributed/fleet/fleet_util.py @@ -18,9 +18,9 @@ import logging import math import os +import re import sys import time -import re import numpy as np