Skip to content
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

Refactor container preparation step #3266

Closed
achimnol opened this issue Dec 18, 2024 · 0 comments · Fixed by #3267
Closed

Refactor container preparation step #3266

achimnol opened this issue Dec 18, 2024 · 0 comments · Fixed by #3267
Assignees
Labels
comp:agent Related to Agent component type:refactor Refactor codes or add tests.
Milestone

Comments

@achimnol
Copy link
Member

achimnol commented Dec 18, 2024

The container creation step works as follows:

  • XXXKernelCreationContext.spawn()
    1. Create the scratch directory for the container.
    2. Prepare /home/config/{environ,resource}.txt. (step A)
    3. Instantiate XXXKernel object to keep track of the container lifecycle.
  • XXXKernelCreationContext.start_container()
    1. Finalize the port mapping.
    2. Create the container.
    3. Append the container ID to /home/config/resource.txt. (step B)
    4. Start the container.

Refactoring

  • Rename spawn() to prepare_container() for clarity.
    • spawn() method does not spawn anything... It just prepares the config files in the scratch directory, and instantiate the internal record object.
  • Remove container_id from KernelResourceSpec.
    • There are duplicate file-write operations for /home/config/resource.txt to just append the container ID (i.e., The step B repeats the entire step A for this). Since there are no other places that read KernelResourceSpec.container_id, we can simply remove it and just append the container ID line after creating the container without repeating the step A.
@achimnol achimnol added the type:refactor Refactor codes or add tests. label Dec 18, 2024
@achimnol achimnol added this to the 24.09 milestone Dec 18, 2024
@achimnol achimnol self-assigned this Dec 18, 2024
@achimnol achimnol added the comp:agent Related to Agent component label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:agent Related to Agent component type:refactor Refactor codes or add tests.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant