-
Notifications
You must be signed in to change notification settings - Fork 450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support to set WorkingDirectory
while running a worker
#10690
base: dev
Are you sure you want to change the base?
Conversation
Have you tried changing the working directory of your worker app once during startup from within your worker app? https://learn.microsoft.com/en-us/dotnet/api/system.io.directory.setcurrentdirectory?view=net-9.0 |
We are trying to run PAL executable (C++ project coming from a Microsoft Reasearch to run |
To clarify, is the goal here to start a Linux executable from the host? If so, where in the environment is it located? Is this a .NET executable, and what is its specific purpose once it starts? For example, how does it initiate the dotnet isolated payload? Could we leverage the |
Yes we want to run a linux worker on linux host. The worker will start a windows sandbox and run a .NET Framework exe. {
"description": {
"language": "dotnet-isolated",
"extensions": [
".dll"
],
"defaultExecutablePath": "{workerDirectoryPath}lapalfe",
"executableWorkingDirectory": "{workerDirectoryPath}",
"defaultWorkerPath": "lapalfe"
},
"processOptions": {
"initializationTimeout": "00:00:30",
"environmentReloadTimeout": "00:00:30"
}
} The thing is, PAL, which is published by MS Research expects the dependent libraries to be part of Everything else, as suggested in last meeting, can be done by the configs, and we have removed the flag we added before Regarding |
@siddharth-ms the worker.config.json allows for setting of executable working directing. Is this not sufficient for your scenario? If not, can you explain why? |
Ohh, does it? How can I set the working directory? |
Ah I misread an existing property - nevermind. |
@@ -18,6 +18,11 @@ public abstract class WorkerDescription | |||
/// </summary> | |||
public string DefaultExecutablePath { get; set; } | |||
|
|||
/// <summary> | |||
/// Gets or sets the working direfory for executing worker. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spelling
@@ -59,7 +61,7 @@ internal RpcWorkerProcess(string runtime, | |||
|
|||
internal override Process CreateWorkerProcess() | |||
{ | |||
var workerContext = new RpcWorkerContext(Guid.NewGuid().ToString(), RpcWorkerConstants.DefaultMaxMessageLengthBytes, _workerId, _workerProcessArguments, _scriptRootPath, _serverUri); | |||
var workerContext = new RpcWorkerContext(Guid.NewGuid().ToString(), RpcWorkerConstants.DefaultMaxMessageLengthBytes, _workerId, _workerProcessArguments, _workerExecutableWorkingDirectory ?? _scriptRootPath, _serverUri); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider doing this defaulting in the ctor at the time when you set _workerExecutableWorkingDirectory
@@ -62,6 +63,23 @@ public RpcWorkerProcessTests() | |||
testEnv, | |||
scriptApplicationHostOptions, | |||
new LoggerFactory()); | |||
|
|||
_rpcWorkerProcessWithExecutablePath = new RpcWorkerProcess("node", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why this needs to be a field? Seems like you can just define this locally in your CreateWorkerProcess_AddsExecutableWorkingDirectory test below, since it's not used anywhere else
@@ -75,7 +93,7 @@ public void Constructor_RegistersHostStartedEvent() | |||
return eventType == typeof(HostStartEvent); | |||
}; | |||
|
|||
_eventManager.Verify(_ => _.Subscribe(It.Is<IObserver<ScriptEvent>>(p => validate(p))), Times.Once()); | |||
_eventManager.Verify(_ => _.Subscribe(It.Is<IObserver<ScriptEvent>>(p => validate(p))), Times.AtLeastOnce()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
Issue describing the changes in this PR
Logic app needs this supper because PAL worker we are running as part of our PAL project, looks for
.spf
libraries in either inCurrentDirectory
orCurrentDirectory/lib
.So we need a support in functions app to set the working directory of a worker process. Currently it defaults to function app's location.
Pull request checklist
IMPORTANT: Currently, changes must be backported to the
in-proc
branch to be included in Core Tools and non-Flex deployments.in-proc
branch is not requiredrelease_notes.md
Additional information
We have tested the changes using a worker config like below to run a pal process in Linux. Test branch
la-hybrid/v4.636.1