Skip to content

Commit bbc13eb

Browse files
authored
[cherry-pick]fix fleetutil get_online_pass_interval bug3 (#60620)
* fix fleetutil get_online_pass_interval bug3; test=develop * fix fleetutil get_online_pass_interval bug3; test=develop * fix fleetutil get_online_pass_interval bug3; test=develop
1 parent 97b65c7 commit bbc13eb

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

python/paddle/incubate/distributed/fleet/fleet_util.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import logging
1919
import math
2020
import os
21+
import re
2122
import sys
2223
import time
2324

@@ -1317,25 +1318,12 @@ def get_online_pass_interval(
13171318
... is_data_hourly_placed=False)
13181319
13191320
"""
1320-
assert (
1321-
"|" not in days
1322-
and ";" not in days
1323-
and "\\" not in days
1324-
and "/" not in days
1325-
and "(" not in days
1326-
and ")" not in days
1327-
and "&" not in days
1328-
), r"days should not contain [|,;,\,/,(,),&]"
1321+
pattern = r'^\d+|{[0-9]+}|{[0-9]+\.\.[0-9]+}$'
1322+
if not re.fullmatch(pattern, str(days)):
1323+
raise Exception("days format is not right")
13291324
days = os.popen("echo -n " + days).read().split(" ")
1330-
assert (
1331-
"|" not in hours
1332-
and ";" not in hours
1333-
and "\\" not in hours
1334-
and "/" not in hours
1335-
and "(" not in hours
1336-
and ")" not in hours
1337-
and "&" not in hours
1338-
), r"hours should not contain [|,;,\,/,(,),&]"
1325+
if not re.fullmatch(pattern, str(hours)):
1326+
raise Exception("hours format is not right")
13391327
hours = os.popen("echo -n " + hours).read().split(" ")
13401328
split_interval = int(split_interval)
13411329
split_per_pass = int(split_per_pass)

0 commit comments

Comments
 (0)