-
Notifications
You must be signed in to change notification settings - Fork 42
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
feat(deadline): add custom user data commands to Worker instance startup #239
Conversation
311b5d5
to
0f526b5
Compare
@@ -0,0 +1 @@ | |||
mkdir test_dir |
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.
nit: Missing newline at end of file.
yarn.lock
Outdated
@@ -10460,6 +10460,17 @@ ts-node@^8.0.2: | |||
source-map-support "^0.5.17" | |||
yn "3.1.1" | |||
|
|||
ts-node@^9.0.0: |
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.
I suspect this wasn't an intended change.
3e1d81e
to
daf8bd6
Compare
postWorkerLaunch(host: IHost): void; | ||
} | ||
|
||
export class InstanceUserDataProvider implements IInstanceUserDataProvider{ |
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.
This should have a docstring explaining what it's for.
daf8bd6
to
2e4a186
Compare
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.
Generally, this looks good. The main request is to add an additional callback and make the base class a construct.
examples/deadline/All-In-AWS-Infrastructure-Basic/python/package/lib/compute_tier.py
Outdated
Show resolved
Hide resolved
examples/deadline/All-In-AWS-Infrastructure-Basic/python/package/lib/compute_tier.py
Outdated
Show resolved
Hide resolved
examples/deadline/All-In-AWS-Infrastructure-Basic/scripts/configure_worker.sh
Show resolved
Hide resolved
// Method that is invoked before configuration Cloud Watch Agent. | ||
preCloudWatchAgent(host: IHost): void; |
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.
these should be made into proper TSDoc strings so that they are visible in our API docs and discoverable from IDEs.
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.
This was missed.
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.
Unless I'm wrong here, the //
syntax is just a comment and not a docstring. i.e. it doesn't end up in the API documentation.
expect(userData).toContain('echo preCloudWatchAgent'); | ||
expect(userData).toContain('echo preDeadlineConfiguration'); | ||
expect(userData).toContain('echo postWorkerLaunch'); |
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.
These make no guarantees that the user data are injected in the correct places. Any ideas on how we can test that here?
We haven't been great about doing this lately, but do you mind also adding documentation for this in |
2e4a186
to
a96ea05
Compare
// Method that is invoked before configuration Cloud Watch Agent. | ||
preCloudWatchAgent(host: IHost): void; |
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.
This was missed.
a96ea05
to
91ac916
Compare
@@ -29,6 +29,39 @@ import { | |||
Version, | |||
} from './version'; | |||
|
|||
/** | |||
* Provider for adding user data scripts | |||
* Methods of this class will be invoked in WorkerInstanceConfiguration |
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.
nit: "Methods of this class"
This isn't a class... it's an interface
postWorkerLaunch(host: IHost): void; | ||
} | ||
|
||
export class InstanceUserDataProvider extends Construct implements IInstanceUserDataProvider{ |
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.
Missing a docstring on this class.
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.
I think this needs more documentation. This class is the API that RFDK users should use in order to achieve custom user data. In here, we should explain that users can sub-class this and override the desired methods to add custom user data commands for WorkerInstanceFleet
or WorkerInstanceConfiguration
.
} | ||
|
||
/** | ||
* This construct can be used to configure Deadline Workers on an instance to connect to a RenderQueue, stream their | ||
* log files to CloudWatch, and configure various settings of the Deadline Worker. | ||
* | ||
* The configuration happens on instance start-up using user data scripting. | ||
* | ||
* The configuration has next steps: |
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.
Maybe "This configuration performs the following steps in order:"
?
// Method that is invoked before configuration Cloud Watch Agent. | ||
preCloudWatchAgent(host: IHost): void; |
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.
Unless I'm wrong here, the //
syntax is just a comment and not a docstring. i.e. it doesn't end up in the API documentation.
fefa0f4
to
c5aab19
Compare
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.
Looking better, but there are a few more things to address here - mostly around the docstrings.
examples/deadline/All-In-AWS-Infrastructure-Basic/python/package/lib/compute_tier.py
Outdated
Show resolved
Hide resolved
examples/deadline/All-In-AWS-Infrastructure-Basic/python/package/config.py
Outdated
Show resolved
Hide resolved
postWorkerLaunch(host: IHost): void; | ||
} | ||
|
||
export class InstanceUserDataProvider extends Construct implements IInstanceUserDataProvider{ |
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.
I think this needs more documentation. This class is the API that RFDK users should use in order to achieve custom user data. In here, we should explain that users can sub-class this and override the desired methods to add custom user data commands for WorkerInstanceFleet
or WorkerInstanceConfiguration
.
95c7f0f
to
882d388
Compare
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.
I notice an issue in the python example that needs to be updated after some PR changes.
def pre_render_queue_configuration(self, host) -> None: | ||
host.user_data.add_commands("echo preRenderQueueConfiguration") | ||
|
||
def pre_deadline_configuration(self, host) -> None: |
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.
I believe this needs to be updated with the new hook name.
882d388
to
64960a1
Compare
Problem
Users do not have possibility to run user data scripts before worker configured and run by RFDK configuration script.
Was created issue with request to add this functional: Worker nodes and UserData
Solution
Was chosen solution that allows user to create class with methods that add user data scripts in all stages of worker configuration.
Was added interface
IInstanceUserDataProvider
and classInstanceUserDataProvider
with three methods.Every method can be overridden by user and has possibility to modify worker user data.
Were added examples for this functionality for Python and Typescript.
Testing
Was added integration tests that cover 100% of new functionality.
Were deployed Python and Typescript examples and verified that all expected code was added to userdata and example script was copied to worker instance and run.
Was removed validation S3Bucket in version query test because these values are changed periodically.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license