@@ -88,7 +88,7 @@ class BaseRunner(metaclass=abc.ABCMeta):
88
88
Convenience argument, use instead of ``goal``. The end condition for the
89
89
calculation. Stop when the current time is larger or equal than this
90
90
value.
91
- timedelta_goal : timedelta, optional
91
+ timedelta_goal : timedelta or int , optional
92
92
Convenience argument, use instead of ``goal``. The end condition for the
93
93
calculation. Stop when the current time is larger or equal than
94
94
``start_time + timedelta_goal``.
@@ -507,7 +507,7 @@ class AsyncRunner(BaseRunner):
507
507
Convenience argument, use instead of ``goal``. The end condition for the
508
508
calculation. Stop when the current time is larger or equal than this
509
509
value.
510
- timedelta_goal : timedelta, optional
510
+ timedelta_goal : timedelta or int , optional
511
511
Convenience argument, use instead of ``goal``. The end condition for the
512
512
calculation. Stop when the current time is larger or equal than
513
513
``start_time + timedelta_goal``.
@@ -831,7 +831,7 @@ def simple(
831
831
Convenience argument, use instead of ``goal``. The end condition for the
832
832
calculation. Stop when the current time is larger or equal than this
833
833
value.
834
- timedelta_goal : timedelta, optional
834
+ timedelta_goal : timedelta or int , optional
835
835
Convenience argument, use instead of ``goal``. The end condition for the
836
836
calculation. Stop when the current time is larger or equal than
837
837
``start_time + timedelta_goal``.
@@ -970,7 +970,9 @@ def _get_ncores(ex):
970
970
971
971
972
972
class _TimeGoal :
973
- def __init__ (self , dt : timedelta | datetime ):
973
+ def __init__ (self , dt : timedelta | datetime | int ):
974
+ if isinstance (dt , int ):
975
+ self .dt = timedelta (seconds = dt )
974
976
self .dt = dt
975
977
self .start_time = None
976
978
@@ -989,33 +991,22 @@ def auto_goal(
989
991
loss : float | None = None ,
990
992
npoints : int | None = None ,
991
993
datetime : datetime | None = None ,
992
- timedelta : timedelta | None = None ,
994
+ timedelta : timedelta | int | None = None ,
993
995
learner : BaseLearner | None = None ,
994
996
allow_running_forever : bool = True ,
995
997
) -> Callable [[BaseLearner ], bool ]:
996
998
"""Extract a goal from the learners.
997
999
998
1000
Parameters
999
1001
----------
1000
- goal
1001
- The goal to extract. Can be a callable, an integer, a float, a datetime,
1002
- a timedelta or None.
1003
- If the type of `goal` is:
1004
- * ``callable``, it is returned as is.
1005
- * ``int``, the goal is reached after that many points have been added.
1006
- * ``float``, the goal is reached when the learner has reached a loss
1007
- equal or less than that.
1008
- * `datetime.datetime`, the goal is reached when the current time is after the
1009
- datetime.
1010
- * `datetime.timedelta`, the goal is reached when the current time is after
1011
- the start time plus that timedelta.
1012
- * ``None`` and
1013
- * the learner type is `adaptive.SequenceLearner`, it continues until
1014
- it no more points to add
1015
- * the learner type is `adaptive.IntegratorLearner`, it continues until the
1016
- error is less than the tolerance specified in the learner.
1017
- * otherwise, it continues forever, unless ``allow_running_forever`` is
1018
- False, in which case it raises a ValueError.
1002
+ loss
1003
+ TODO
1004
+ npoints
1005
+ TODO
1006
+ datetime
1007
+ TODO
1008
+ timedelta
1009
+ TODO
1019
1010
learner
1020
1011
Learner for which to determine the goal.
1021
1012
allow_running_forever
0 commit comments