diff --git a/src/condor.erl b/src/condor.erl index ff77041..0863a4d 100644 --- a/src/condor.erl +++ b/src/condor.erl @@ -152,3 +152,21 @@ format_submit(CondorParams0) -> SubmitFileStr = maps:fold(fun(K, V, Acc) -> [Acc, io_lib:format("~p = ~s", [K,V]), LineSep] end, "", CondorParams1), iolist_to_binary([LineSep, lists:flatten(SubmitFileStr), LineSep, "Queue", LineSep]). +%% @doc Converts the transfer_input_files field from a Condor submit map to a +%% comma-separated string. +%% +%% The only parameter that might come here as a list instead of complete +%% cs-string is transfer_input_files because it might be generated by +%% Cuneiform and it needs file validation. Therefore any declared +%% transfer_input_files params need to be first parsed from cs-string +%% into a list, and once they are validated and possibly merged, they are +%% converted back to cs-string here. +%% +-spec input_files_to_cs_string( CondorParams ) -> #{atom() => string()} +when CondorParams :: #{atom() => string() | [string()]}. + +input_files_to_cs_string(#{transfer_input_files := InputFiles} = CondorParams) -> + InputFilesCS = string:join(InputFiles, ", "), + maps:put(transfer_input_files, InputFilesCS, CondorParams); + +input_files_to_cs_string(CondorParams) -> CondorParams. \ No newline at end of file