@@ -344,17 +344,12 @@ def compile(
344344 )
345345 if 'PCH file' in str (e ):
346346 get_logger ().warning (
347- "%s, %s" ,
348- "CmdStan's precompiled header (PCH) files " ,
349- "may need to be rebuilt." ,
350- )
351- get_logger ().warning (
352- "%s %s" ,
353- "If your model failed to compile please run " ,
354- "install_cmdstan(overwrite=True)." ,
355- )
356- get_logger ().warning (
357- "If the issue persists please open a bug report"
347+ "%s" ,
348+ "CmdStan's precompiled header (PCH) files "
349+ "may need to be rebuilt."
350+ "If your model failed to compile please run "
351+ "install_cmdstan(overwrite=True).\n If the "
352+ "issue persists please open a bug report" ,
358353 )
359354
360355 compilation_failed = True
@@ -398,6 +393,7 @@ def optimize(
398393 history_size : Optional [int ] = None ,
399394 iter : Optional [int ] = None ,
400395 refresh : Optional [int ] = None ,
396+ time_fmt : str = "%Y%m%d%H%M%S" ,
401397 ) -> CmdStanMLE :
402398 """
403399 Run the specified CmdStan optimize algorithm to produce a
@@ -484,6 +480,10 @@ def optimize(
484480 :param refresh: Specify the number of iterations cmdstan will take
485481 between progress messages. Default value is 100.
486482
483+ :param time_fmt: A format string passed to
484+ :meth:`~datetime.datetime.strftime` to decide the file names for
485+ output CSVs. Defaults to "%Y%m%d%H%M%S"
486+
487487 :return: CmdStanMLE object
488488 """
489489 optimize_args = OptimizeArgs (
@@ -514,7 +514,7 @@ def optimize(
514514 )
515515
516516 dummy_chain_id = 0
517- runset = RunSet (args = args , chains = 1 )
517+ runset = RunSet (args = args , chains = 1 , time_fmt = time_fmt )
518518 self ._run_cmdstan (runset , dummy_chain_id )
519519
520520 if not runset ._check_retcodes ():
@@ -555,6 +555,7 @@ def sample(
555555 save_profile : bool = False ,
556556 show_progress : Union [bool , str ] = False ,
557557 refresh : Optional [int ] = None ,
558+ time_fmt : str = "%Y%m%d%H%M%S" ,
558559 ) -> CmdStanMCMC :
559560 """
560561 Run or more chains of the NUTS-HMC sampler to produce a set of draws
@@ -718,6 +719,10 @@ def sample(
718719 :param refresh: Specify the number of iterations cmdstan will take
719720 between progress messages. Default value is 100.
720721
722+ :param time_fmt: A format string passed to
723+ :meth:`~datetime.datetime.strftime` to decide the file names for
724+ output CSVs. Defaults to "%Y%m%d%H%M%S"
725+
721726 :return: CmdStanMCMC object
722727 """
723728 if chains is None :
@@ -829,7 +834,9 @@ def sample(
829834 method_args = sampler_args ,
830835 refresh = refresh ,
831836 )
832- runset = RunSet (args = args , chains = chains , chain_ids = chain_ids )
837+ runset = RunSet (
838+ args = args , chains = chains , chain_ids = chain_ids , time_fmt = time_fmt
839+ )
833840 pbar = None
834841 all_pbars = []
835842
@@ -899,6 +906,7 @@ def generate_quantities(
899906 gq_output_dir : Optional [str ] = None ,
900907 sig_figs : Optional [int ] = None ,
901908 refresh : Optional [int ] = None ,
909+ time_fmt : str = "%Y%m%d%H%M%S" ,
902910 ) -> CmdStanGQ :
903911 """
904912 Run CmdStan's generate_quantities method which runs the generated
@@ -950,6 +958,10 @@ def generate_quantities(
950958 :param refresh: Specify the number of iterations cmdstan will take
951959 between progress messages. Default value is 100.
952960
961+ :param time_fmt: A format string passed to
962+ :meth:`~datetime.datetime.strftime` to decide the file names for
963+ output CSVs. Defaults to "%Y%m%d%H%M%S"
964+
953965 :return: CmdStanGQ object
954966 """
955967 if isinstance (mcmc_sample , CmdStanMCMC ):
@@ -999,7 +1011,9 @@ def generate_quantities(
9991011 method_args = generate_quantities_args ,
10001012 refresh = refresh ,
10011013 )
1002- runset = RunSet (args = args , chains = chains , chain_ids = chain_ids )
1014+ runset = RunSet (
1015+ args = args , chains = chains , chain_ids = chain_ids , time_fmt = time_fmt
1016+ )
10031017
10041018 parallel_chains_avail = cpu_count ()
10051019 parallel_chains = max (min (parallel_chains_avail - 2 , chains ), 1 )
@@ -1039,6 +1053,7 @@ def variational(
10391053 output_samples : Optional [int ] = None ,
10401054 require_converged : bool = True ,
10411055 refresh : Optional [int ] = None ,
1056+ time_fmt : str = "%Y%m%d%H%M%S" ,
10421057 ) -> CmdStanVB :
10431058 """
10441059 Run CmdStan's variational inference algorithm to approximate
@@ -1123,6 +1138,10 @@ def variational(
11231138 :param refresh: Specify the number of iterations cmdstan will take
11241139 between progress messages. Default value is 100.
11251140
1141+ :param time_fmt: A format string passed to
1142+ :meth:`~datetime.datetime.strftime` to decide the file names for
1143+ output CSVs. Defaults to "%Y%m%d%H%M%S"
1144+
11261145 :return: CmdStanVB object
11271146 """
11281147 variational_args = VariationalArgs (
@@ -1155,7 +1174,7 @@ def variational(
11551174 )
11561175
11571176 dummy_chain_id = 0
1158- runset = RunSet (args = args , chains = 1 )
1177+ runset = RunSet (args = args , chains = 1 , time_fmt = time_fmt )
11591178 self ._run_cmdstan (runset , dummy_chain_id )
11601179
11611180 # treat failure to converge as failure
0 commit comments