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

suite: config_yaml should contain yaml content instead of path/to/yaml #44

Open
VallariAg opened this issue Jan 18, 2024 · 9 comments
Open
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@VallariAg
Copy link
Member

Route /suite has <config_yaml> in request schema. It takes path to the yaml config file in the data body, for example:

{
        "--ceph": "main",
        "--ceph-repo": "https://github.com/ceph/ceph-ci.git",
        "--machine-type": "testnode",
        "--num": "1",
        "--priority": "70",
        "--suite": "teuthology:no-ceph",
        "--suite-branch": "main",
        "--suite-repo": "https://github.com/ceph/ceph-ci.git",
        "--teuthology-branch": "main",
        "--verbose": "1",
        "--user": "example",
        "<config_yaml>": ["/path/to/yaml"]
     }

config_yaml: Union[list, None] = Field(default=[], alias="<config_yaml>")

This would mean that the config file should already exist on t-api's server. For more practical use-case, we can accept a string with the yaml config content. After receiving a request, teuthology-api can save this yaml content in a temporary file and then pass path to that file to teuthology.suite.main function.

@VallariAg VallariAg added good first issue Good for newcomers bug Something isn't working labels Jan 18, 2024
@Devansh3712
Copy link
Member

I'd like to work on this issue. So basically instead of the YAML file path the request would contain the contents of the file, and we need to save it as a temporary file (something like <username>_<timestamp>.yaml) and pass that to the teuthology function?

@VallariAg
Copy link
Member Author

Correct! You can create the temporary file using https://docs.python.org/3/library/tempfile.html and then delete it after the scheduling is finished.

@Devansh3712
Copy link
Member

Understood, I'll take a look at this library and start working on it!

@Devansh3712 Devansh3712 self-assigned this Feb 1, 2024
@Devansh3712
Copy link
Member

I looked at the tempfile module and this is what I was able to gather. Once the with block is over, the temporary file will be deleted automatically and until then it will show as a temporary file on the system.

image

after writing the YAML content to this tmp, we can pass it on to the teuthology.main function, and can put the user's name as suffix if required

@VallariAg
Copy link
Member Author

Yes, that sounds good! Like in our docker setup, we use this yaml config while scheduling: https://github.com/ceph/teuthology/blob/main/docs/docker-compose/teuthology/containerized_node.yaml

Also it's possible to get multiple configs which is why "<config_yaml>" param is a list in /suite schema. So you'll probably want to create a new file for every config and then send path of each temp file to teuthology.main.

@Devansh3712
Copy link
Member

So after creating temporary files for all configs, I should replace the <config_yaml> key with the list of names of those temporary files?

@octonawish-akcodes
Copy link

can i work on this? @VallariAg

@VallariAg
Copy link
Member Author

So after creating temporary files for all configs, I should replace the <config_yaml> key with the list of names of those temporary files?

@Devansh3712 sorry for late reply! And yes, you pass the path of all the temporary config files like: {"<config_yaml>": ["path/to/config.yaml"] ....}. I think that should work!

@octonawish-akcodes please check with Devansh if he's still working on this issue.

@Devansh3712
Copy link
Member

understood, and yes i'm working on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants