Skip to content

Commit

Permalink
Move functions for connections into own module
Browse files Browse the repository at this point in the history
  • Loading branch information
zieglerSe committed Nov 13, 2023
1 parent 0ce9568 commit 20e3858
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/Slurmi/Connection.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
namespace Slurmi
open DynamicObj
open System.Runtime.InteropServices
open Fli

module Connection =

let matchOutput (output) =
match output with
| Some value -> value
| None -> failwith "No output"

let callToTerminalCMD (command:string) =
let processResponse =
cli {
Shell CMD
Command command
}
|> Command.execute
// processResponse.Text
processResponse
let callToTerminalBash (command:string) =
let processResponse =
cli {
Shell BASH
Command command
}
|> Command.execute
// processResponse.Text
processResponse

let getResultFromCallCMD (command:string) =
(callToTerminalCMD (command)).Text
|> matchOutput

let getResultFromCallBash (command:string) =
(callToTerminalBash (command)).Text
|> matchOutput

let sendToTerminalAndReceiveJobIDBash (job:Job)=
//job.OnlyKey |> OnlyKey.SetParsable true |> ignore

let res = getResultFromCallBash (job.formatProcess)
// submit
// get return
// set as Job ID
job |> Job.SetJobID res |> ignore


let sendToTerminalAndReceiveJobIDCMD (job:Job)=
// job
// set parsable
//job.OnlyKey |> OnlyKey.SetParsable true |> ignore

let res = getResultFromCallCMD (job.formatProcess)
// submit
// get return
// set as Job ID
job |> Job.SetJobID res |> ignore

1 change: 1 addition & 0 deletions src/Slurmi/Slurmi.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<Compile Include="Process.fs" />
<Compile Include="Dependency.fs" />
<Compile Include="Job.fs" />
<Compile Include="Connection.fs" />
<Compile Include="Workflow.fs" />
</ItemGroup>

Expand Down

0 comments on commit 20e3858

Please sign in to comment.