Skip to content

Commit

Permalink
Missing function added.
Browse files Browse the repository at this point in the history
  • Loading branch information
joergen7 committed Apr 11, 2016
1 parent 82e3b6f commit 740993c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/condor.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 740993c

Please sign in to comment.