├── .github └── workflows │ ├── build.yml │ └── release.yml ├── .gitignore ├── .goreleaser.yaml ├── .vscode ├── launch.json └── settings.json ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── README.md ├── client ├── cluster.go ├── node.go ├── pod.go ├── types.go ├── utils.go └── workload.go ├── cmd ├── create.go ├── delete.go ├── docs.go ├── list.go ├── root.go └── version.go ├── docs ├── .gitbook │ └── assets │ │ ├── image (1).png │ │ ├── workload 1.png │ │ ├── workload 2.png │ │ └── workload.png ├── README.md ├── SUMMARY.md ├── examples │ ├── gromacs-creation-automation.md │ └── gromacs.md ├── get-started │ ├── authentication.md │ ├── config.md │ └── installation.md ├── guides │ └── workload-management.md └── references │ └── cli │ ├── cedana-cli.md │ ├── cedana-cli_completion.md │ ├── cedana-cli_completion_bash.md │ ├── cedana-cli_completion_fish.md │ ├── cedana-cli_completion_powershell.md │ ├── cedana-cli_completion_zsh.md │ ├── cedana-cli_create.md │ ├── cedana-cli_create_workload.md │ ├── cedana-cli_delete.md │ ├── cedana-cli_delete_workload.md │ ├── cedana-cli_list.md │ ├── cedana-cli_list_cluster.md │ ├── cedana-cli_list_node.md │ └── cedana-cli_list_pod.md ├── go.mod ├── go.sum ├── main.go └── pkg ├── config ├── config.go └── types.go ├── flags └── cmd.go ├── logging └── logger.go └── style └── cmd.go /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v3 11 | 12 | - name: Set up Go 13 | uses: actions/setup-go@v4 14 | with: 15 | go-version: '1.21' 16 | 17 | - name: Build 18 | run: go build -v ./... 19 | 20 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | permissions: 9 | contents: write 10 | 11 | jobs: 12 | release: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - 16 | name: Checkout 17 | uses: actions/checkout@v3 18 | with: 19 | fetch-depth: 0 20 | - 21 | name: Set up Go 22 | uses: actions/setup-go@v4 23 | - 24 | name: Run GoReleaser 25 | uses: goreleaser/goreleaser-action@v4 26 | with: 27 | distribution: goreleaser 28 | version: latest 29 | args: release --clean 30 | env: 31 | GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} 32 | - 33 | name: Upload to PackageCloud 34 | continue-on-error: true 35 | uses: docker://lpenz/ghaction-packagecloud:0.4 36 | with: 37 | user: nravic 38 | repository: "cedana-cli/ubuntu/jammy" 39 | env: 40 | PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | cedana-cli 2 | work_dir 3 | dist/ 4 | *.vhs 5 | caltech-* 6 | .gitconfig 7 | -------------------------------------------------------------------------------- /.goreleaser.yaml: -------------------------------------------------------------------------------- 1 | before: 2 | hooks: 3 | - go mod tidy 4 | - go generate ./... 5 | builds: 6 | - env: 7 | - CGO_ENABLED=0 8 | goarch: 9 | - amd64 10 | goos: 11 | - linux 12 | - darwin 13 | checksum: 14 | name_template: 'checksums.txt' 15 | snapshot: 16 | name_template: "{{ incpatch .Version }}-next" 17 | changelog: 18 | sort: asc 19 | filters: 20 | exclude: 21 | - '^docs:' 22 | - '^test:' 23 | nfpms: 24 | - 25 | id: default 26 | package_name: cedana-cli 27 | file_name_template: "{{ .ConventionalFileName }}" 28 | vendor: Cedana Systems 29 | 30 | homepage: cedana.ai 31 | maintainer: Niranjan Ravichandra 32 | 33 | description: |- 34 | Orchestrator software for fast, adaptive checkpointing for cloud brokerage. 35 | 36 | license: GNU APLv3 37 | 38 | formats: 39 | - deb 40 | - rpm 41 | - archlinux # Since GoReleaser v1.13. 42 | 43 | suggests: 44 | - criu 45 | brews: 46 | - homepage: cedana.ai 47 | folder: Formula 48 | commit_author: 49 | name: nravic 50 | email: nravic@cedana.ai 51 | tap: 52 | owner: cedana 53 | name: homebrew-cedana-cli -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "name": "sudo debug cedana-cli run", 10 | "type": "go", 11 | "request": "launch", 12 | "mode": "debug", 13 | "program": "${workspaceFolder}", 14 | "console": "integratedTerminal", 15 | "args": ["run", "test/integration/jobs/job.yml"], 16 | 17 | }, 18 | { 19 | "name": "sudo debug cedana-cli whisper restore", 20 | "type": "go", 21 | "request": "launch", 22 | "mode": "debug", 23 | "program": "${workspaceFolder}", 24 | "console": "integratedTerminal", 25 | "args": ["whisper", "restore", "-j", "${input:promptForJobID}"], 26 | 27 | }, 28 | { 29 | "name": "debug cedana-cli bootstrap", 30 | "type": "go", 31 | "request": "launch", 32 | "mode": "debug", 33 | "program": "${fileDirname}", 34 | "console": "integratedTerminal", 35 | "args": ["bootstrap"], 36 | 37 | }, 38 | { 39 | "name": "debug cedana-cli server", 40 | "type": "go", 41 | "request": "launch", 42 | "mode": "debug", 43 | "program": "${fileDirname}", 44 | "console": "integratedTerminal", 45 | "env": { 46 | "CEDANA_ORCH_ID": "orch123", 47 | "CEDANA_JOB_ID": "testjob", 48 | "CEDANA_CLIENT_ID": "client123", 49 | "CEDANA_LOG_LEVEL": "0", 50 | "GO111MODULE": "on" 51 | }, 52 | "args": ["server"], 53 | 54 | }, 55 | 56 | { 57 | "name": "debug cedana-cli show", 58 | "type": "go", 59 | "request": "launch", 60 | "mode": "debug", 61 | "program": "${fileDirname}", 62 | "console": "integratedTerminal", 63 | "args": ["show"], 64 | "env": { 65 | "CEDANA_LOG_LEVEL": "0" 66 | } 67 | }, 68 | { 69 | "name": "debug cedana-cli restore", 70 | "type": "go", 71 | "request": "launch", 72 | "mode": "debug", 73 | "program": "${fileDirname}", 74 | "console": "integratedTerminal", 75 | "args": ["restore", "${input:promptForJobID}"], 76 | "env": { 77 | "CEDANA_LOG_LEVEL": "0" 78 | } 79 | }, 80 | { 81 | "name": "debug cedana-cli destroy-all", 82 | "type": "go", 83 | "request": "launch", 84 | "mode": "debug", 85 | "program": "${fileDirname}", 86 | "console": "integratedTerminal", 87 | "args": ["destroy-all"], 88 | "env": { 89 | "CEDANA_LOG_LEVEL": "0", 90 | "GO111MODULE": "on" 91 | } 92 | }, 93 | { 94 | "name": "debug cedana-cli job status", 95 | "type": "go", 96 | "request": "launch", 97 | "mode": "debug", 98 | "program": "${fileDirname}", 99 | "console": "integratedTerminal", 100 | "args": ["job", "status"], 101 | "env": { 102 | "CEDANA_LOG_LEVEL": "0" 103 | } 104 | }, 105 | 106 | { 107 | "name": "debug cedana-cli list-checkpoints", 108 | "type": "go", 109 | "request": "launch", 110 | "mode": "debug", 111 | "program": "${fileDirname}", 112 | "console": "integratedTerminal", 113 | "args": ["whisper", "list-checkpoints", "-j", "${input:promptForJobID}"], 114 | "env": { 115 | "CEDANA_LOG_LEVEL": "0", 116 | "GO111MODULE": "on" 117 | } 118 | } 119 | 120 | ], 121 | "inputs": [ 122 | { 123 | "id": "promptForJobID", 124 | "type": "promptString", 125 | "description": "enter job ID", 126 | "default": "" 127 | }, 128 | ] 129 | } 130 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "restructuredtext.preview.docutils.disabled": true, 3 | "[python]": { 4 | "editor.defaultFormatter": "ms-python.autopep8" 5 | }, 6 | "python.formatting.provider": "none" 7 | } 8 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## How to contribute to Cedana 2 | 3 | We encourage any and all contributions of any and all sizes! 4 | 5 | We don't have a formal process yet, just open a PR :) If you found a bug, as much context as possible (environment, what you were trying to do, logfiles, etc) would be greatly appreciated. 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | BINARY_NAME = cedana-cli 2 | INSTALL_PATH = /usr/local/bin 3 | SUDO=sudo 4 | 5 | .PHONY: all build install clean 6 | 7 | all: build install 8 | 9 | build: 10 | go build -o $(BINARY_NAME) 11 | 12 | install: build 13 | $(SUDO) install $(BINARY_NAME) $(INSTALL_PATH) 14 | 15 | clean: 16 | $(SUDO) rm -f $(INSTALL_PATH)/$(BINARY_NAME) 17 | $(SUDO) rm -f $(BINARY_NAME) 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cedana-cli 2 | 3 | [Cedana](https://cedana.ai) is a framework for the democritization and (eventually) commodification of compute. We achieve this by leveraging checkpoint/restore to seamlessly migrate work across machines, clouds and beyond. 4 | 5 | This repo contains a CLI tool to allow developers to experiment with our system. 6 | 7 | ## Usage 8 | 9 | To build & install from source: 10 | ```bash 11 | make 12 | ``` 13 | 14 | To get started: 15 | ```bash 16 | export CEDANA_URL="https://sandbox.cedana.ai/v1" 17 | export CEDANA_AUTH_TOKEN= 18 | 19 | cedana-cli --help 20 | ``` 21 | 22 | ## Documentation 23 | 24 | We are still working on the documentation. 25 | 26 | ## Deprecation Notice 27 | 28 | `cedana-cli` used to have a self-serve tool, but it has been retired in favor of fulltime development on our managed platform. If you still wish to use it however, you can revert to previous versions (<=v0.2.8). 29 | 30 |
31 | ### Deprecated functionality description 32 | 33 | With it, you can: 34 | 35 | - Launch instances anywhere, with guaranteed price and capacity optimization. We look across your configured providers (AWS, Paperspace, etc.) to select the optimal instance defined in a provided job spec. This abstracts away cloud infra burdens. (On older versions only) 36 | - Deploy and manage any kind of job, whether a pyTorch training job, a webservice or a multibody physics simulation on kubernetes. 37 | 38 | Our managed system layers many more capabilities on top of this, such as: lifecycle management, policy systems, auto migration (through our novel checkpointing system (see [here](https://github.com/cedana/cedana))) and much more. 39 | 40 | To access our managed service, contact . 41 |
42 | 43 | ## Contributing 44 | 45 | See CONTRIBUTING.md for guidelines. 46 | -------------------------------------------------------------------------------- /client/cluster.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | 7 | "github.com/cedana/cedana-cli/pkg/config" 8 | ) 9 | 10 | // ListClusters makes a GET request to fetch all clusters 11 | func ListClusters() ([]Cluster, error) { 12 | cedanaURL := config.Global.Connection.URL 13 | cedanaAuthToken := config.Global.Connection.AuthToken 14 | var clusters []Cluster 15 | resp, err := clientRequest("GET", cedanaURL+"/cluster", cedanaAuthToken, nil) 16 | if err != nil { 17 | return nil, fmt.Errorf("error decoding response: %v", err) 18 | } 19 | defer resp.Body.Close() 20 | if err := json.NewDecoder(resp.Body).Decode(&clusters); err != nil { 21 | return nil, fmt.Errorf("error decoding response: %v", err) 22 | } 23 | return clusters, nil 24 | } 25 | -------------------------------------------------------------------------------- /client/node.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | 7 | "github.com/cedana/cedana-cli/pkg/config" 8 | ) 9 | 10 | // GetClusterNodes makes a POST request to fetch nodes for a given cluster 11 | func GetClusterNodes(clusterName string) ([]Node, error) { 12 | cedanaURL := config.Global.Connection.URL 13 | cedanaAuthToken := config.Global.Connection.AuthToken 14 | 15 | payload := map[string]string{ 16 | "cluster_name": clusterName, 17 | } 18 | 19 | jsonData, err := json.Marshal(payload) 20 | if err != nil { 21 | return nil, fmt.Errorf("error marshaling payload: %v", err) 22 | } 23 | 24 | resp, err := clientRequest("POST", cedanaURL+"/cluster/nodes", cedanaAuthToken, jsonData) 25 | if err != nil { 26 | return nil, fmt.Errorf("error decoding response: %v", err) 27 | } 28 | defer resp.Body.Close() 29 | var nodes []Node 30 | if err := json.NewDecoder(resp.Body).Decode(&nodes); err != nil { 31 | return nil, fmt.Errorf("error decoding response: %v", err) 32 | } 33 | 34 | return nodes, nil 35 | } 36 | -------------------------------------------------------------------------------- /client/pod.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | 7 | "github.com/cedana/cedana-cli/pkg/config" 8 | ) 9 | 10 | // GetClusterNodes makes a POST request to fetch nodes for a given cluster 11 | func GetClusterPods(clusterName string, clusterNamespace string) ([]Pod, error) { 12 | cedanaURL := config.Global.Connection.URL 13 | cedanaAuthToken := config.Global.Connection.AuthToken 14 | 15 | payload := map[string]string{ 16 | "cluster_name": clusterName, 17 | } 18 | 19 | jsonData, err := json.Marshal(payload) 20 | if err != nil { 21 | return nil, fmt.Errorf("error marshaling payload: %v", err) 22 | } 23 | 24 | resp, err := clientRequest("POST", cedanaURL+"/cluster/pods/"+clusterNamespace, cedanaAuthToken, jsonData) 25 | if err != nil { 26 | return nil, fmt.Errorf("error decoding response: %v", err) 27 | } 28 | defer resp.Body.Close() 29 | var pods []Pod 30 | if err := json.NewDecoder(resp.Body).Decode(&pods); err != nil { 31 | return nil, fmt.Errorf("error decoding response: %v", err) 32 | } 33 | 34 | return pods, nil 35 | } 36 | -------------------------------------------------------------------------------- /client/types.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | // Node represents a node in the cluster response 4 | type Node struct { 5 | ID string `json:"ID"` 6 | ClusterID string `json:"ClusterID"` 7 | Name string `json:"Name"` 8 | Status string `json:"Status"` 9 | ComputeType string `json:"ComputeType"` 10 | InstanceType string `json:"InstanceType"` 11 | Region string `json:"Region"` 12 | } 13 | 14 | // Cluster represents a cluster in the response 15 | type Cluster struct { 16 | ID string `json:"ID"` 17 | OrgID string `json:"OrgID"` 18 | Name string `json:"Name"` 19 | Status string `json:"Status"` 20 | Metadata interface{} `json:"Metadata"` 21 | } 22 | 23 | type Pod struct { 24 | ID string `json:"ID"` 25 | ClusterID string `json:"ClusterID"` 26 | NodeID string `json:"NodeID"` 27 | Name string `json:"Name"` 28 | Namespace string `json:"Namespace"` 29 | Status string `json:"Status"` 30 | Metadata interface{} `json:"Metadata"` 31 | } 32 | -------------------------------------------------------------------------------- /client/utils.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | "net/http" 8 | ) 9 | 10 | // helper function for all requests 11 | func clientRequest(reqType string, apiURL string, apiToken string, payload []byte) (*http.Response, error) { 12 | var err error 13 | 14 | req, err := http.NewRequest(reqType, apiURL, bytes.NewBuffer(payload)) 15 | if err != nil { 16 | return nil, fmt.Errorf("error creating request: %v", err) 17 | } 18 | 19 | req.Header.Set("Authorization", "Bearer "+apiToken) 20 | req.Header.Set("Content-Type", "application/json") 21 | 22 | client := &http.Client{} 23 | resp, err := client.Do(req) 24 | if err != nil { 25 | return nil, fmt.Errorf("error sending request: %v", err) 26 | } 27 | 28 | if resp.StatusCode != http.StatusOK { 29 | body, _ := io.ReadAll(resp.Body) 30 | return nil, fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) 31 | } 32 | 33 | return resp, nil 34 | } 35 | 36 | // TODO: minimize duplicated code 37 | func yamlClientRequest(reqType string, apiURL string, apiToken string, payload []byte) (*http.Response, error) { 38 | var err error 39 | 40 | req, err := http.NewRequest(reqType, apiURL, bytes.NewBuffer(payload)) 41 | if err != nil { 42 | return nil, fmt.Errorf("error creating request: %v", err) 43 | } 44 | 45 | req.Header.Set("Authorization", "Bearer "+apiToken) 46 | req.Header.Set("Content-Type", "application/yaml") 47 | 48 | client := &http.Client{} 49 | resp, err := client.Do(req) 50 | if err != nil { 51 | return nil, fmt.Errorf("error sending request: %v", err) 52 | } 53 | 54 | if resp.StatusCode != http.StatusOK { 55 | body, _ := io.ReadAll(resp.Body) 56 | return nil, fmt.Errorf("request failed with status %d: %s", resp.StatusCode, string(body)) 57 | } 58 | 59 | return resp, nil 60 | } 61 | -------------------------------------------------------------------------------- /client/workload.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "net/http" 7 | 8 | "github.com/cedana/cedana-cli/pkg/config" 9 | ) 10 | 11 | // GetClusterNodes makes a POST request to fetch nodes for a given cluster 12 | func CreateWorkload(payload []byte, contentType string) (string, error) { 13 | cedanaURL := config.Global.Connection.URL 14 | cedanaAuthToken := config.Global.Connection.AuthToken 15 | 16 | var resp *http.Response 17 | var err error 18 | 19 | if contentType == "yaml" { 20 | resp, err = yamlClientRequest("POST", cedanaURL+"/cluster/workload", cedanaAuthToken, payload) 21 | } else { 22 | resp, err = clientRequest("POST", cedanaURL+"/cluster/workload", cedanaAuthToken, payload) 23 | } 24 | 25 | if err != nil { 26 | return "", fmt.Errorf("%v", err) 27 | } 28 | defer resp.Body.Close() 29 | bodyBytes, err := io.ReadAll(resp.Body) 30 | if err != nil { 31 | return "", fmt.Errorf("%v", err) 32 | } 33 | return string(bodyBytes), nil 34 | } 35 | 36 | func DeleteWorkload(payload []byte, contentType string) (string, error) { 37 | cedanaURL := config.Global.Connection.URL 38 | cedanaAuthToken := config.Global.Connection.AuthToken 39 | 40 | var resp *http.Response 41 | var err error 42 | 43 | if contentType == "yaml" { 44 | resp, err = yamlClientRequest("DELETE", cedanaURL+"/cluster/workload", cedanaAuthToken, payload) 45 | } else { 46 | resp, err = clientRequest("DELETE", cedanaURL+"/cluster/workload", cedanaAuthToken, payload) 47 | } 48 | 49 | if err != nil { 50 | return "", fmt.Errorf("%v", err) 51 | } 52 | 53 | defer resp.Body.Close() 54 | bodyBytes, err := io.ReadAll(resp.Body) 55 | if err != nil { 56 | return "", fmt.Errorf("%v", err) 57 | } 58 | return string(bodyBytes), nil 59 | } 60 | -------------------------------------------------------------------------------- /cmd/create.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2025 NAME HERE 3 | */ 4 | package cmd 5 | 6 | import ( 7 | "fmt" 8 | "os" 9 | 10 | "github.com/cedana/cedana-cli/client" 11 | "github.com/spf13/cobra" 12 | ) 13 | 14 | // workloadCmd represents the workload command 15 | var createCmd = &cobra.Command{ 16 | Use: "create", 17 | Short: "Create a new resource", 18 | Long: `Create a new resource with a json payload`, 19 | Run: func(cmd *cobra.Command, args []string) { 20 | payloadPath, err := cmd.Flags().GetString("payload") 21 | if err != nil { 22 | fmt.Printf("Error retrieving payload flag: %v\n", err) 23 | return 24 | } 25 | contentType, err := cmd.Flags().GetString("contentType") 26 | if err != nil { 27 | fmt.Printf("Error retrieving contentType flag: %v\n", err) 28 | return 29 | } 30 | payloadData, err := os.ReadFile(payloadPath) 31 | if err != nil { 32 | fmt.Printf("Error reading payload file %s: %v\n", payloadPath, err) 33 | return 34 | } 35 | resp, err := client.CreateWorkload(payloadData, contentType) 36 | 37 | if err != nil { 38 | fmt.Printf("Error: %v\n", err) 39 | return 40 | } 41 | fmt.Println(resp) 42 | }, 43 | } 44 | 45 | var createWorkloadCmd = &cobra.Command{ 46 | Use: "workload", 47 | Short: "Create a new workload", 48 | Long: `Create a new workload with the provided configuration.`, 49 | Run: func(cmd *cobra.Command, args []string) { 50 | payloadPath, err := cmd.Flags().GetString("payload") 51 | if err != nil { 52 | fmt.Printf("Error retrieving payload flag: %v\n", err) 53 | return 54 | } 55 | 56 | contentType, err := cmd.Flags().GetString("contentType") 57 | if err != nil { 58 | fmt.Printf("Error retrieving contentType flag: %v\n", err) 59 | return 60 | } 61 | 62 | payloadData, err := os.ReadFile(payloadPath) 63 | if err != nil { 64 | fmt.Printf("Error reading payload file %s: %v\n", payloadPath, err) 65 | return 66 | } 67 | 68 | resp, err := client.CreateWorkload(payloadData, contentType) 69 | 70 | if err != nil { 71 | fmt.Printf("Error: %v\n", err) 72 | return 73 | } 74 | fmt.Println(resp) 75 | }, 76 | } 77 | 78 | func init() { 79 | rootCmd.AddCommand(createCmd) 80 | createCmd.AddCommand(createWorkloadCmd) 81 | 82 | // Here you will define your flags and configuration settings. 83 | 84 | // Cobra supports Persistent Flags which will work for this command 85 | // and all subcommands, e.g.: 86 | createWorkloadCmd.PersistentFlags().String("payload", "", "workload payload path") 87 | createWorkloadCmd.PersistentFlags().String("contentType", "", "Can be either json or yaml") 88 | 89 | // Cobra supports local flags which will only run when this command 90 | // is called directly, e.g.: 91 | // workloadCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") 92 | } 93 | -------------------------------------------------------------------------------- /cmd/delete.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2025 NAME HERE 3 | */ 4 | package cmd 5 | 6 | import ( 7 | "fmt" 8 | "os" 9 | 10 | "github.com/cedana/cedana-cli/client" 11 | "github.com/spf13/cobra" 12 | ) 13 | 14 | // workloadCmd represents the workload command 15 | var deleteCmd = &cobra.Command{ 16 | Use: "delete", 17 | Short: "Delete an existing resource", 18 | Long: `Delete an existing resource with the provided configuration.`, 19 | Run: func(cmd *cobra.Command, args []string) { 20 | payloadPath, err := cmd.Flags().GetString("payload") 21 | if err != nil { 22 | fmt.Printf("Error retrieving payload flag: %v\n", err) 23 | return 24 | } 25 | contentType, err := cmd.Flags().GetString("contentType") 26 | if err != nil { 27 | fmt.Printf("Error retrieving contentType flag: %v\n", err) 28 | return 29 | } 30 | payloadData, err := os.ReadFile(payloadPath) 31 | if err != nil { 32 | fmt.Printf("Error reading payload file %s: %v\n", payloadPath, err) 33 | return 34 | } 35 | 36 | resp, err := client.CreateWorkload(payloadData, contentType) 37 | 38 | if err != nil { 39 | fmt.Printf("Error: %v\n", err) 40 | return 41 | } 42 | fmt.Println(resp) 43 | }, 44 | } 45 | 46 | var deleteWorkloadCmd = &cobra.Command{ 47 | Use: "workload", 48 | Short: "Delete a running workload", 49 | Long: `Delete a running workload with the provided configuration.`, 50 | Run: func(cmd *cobra.Command, args []string) { 51 | payloadPath, err := cmd.Flags().GetString("payload") 52 | if err != nil { 53 | fmt.Printf("Error retrieving payload flag: %v\n", err) 54 | return 55 | } 56 | contentType, err := cmd.Flags().GetString("contentType") 57 | if err != nil { 58 | fmt.Printf("Error retrieving contentType flag: %v\n", err) 59 | return 60 | } 61 | payloadData, err := os.ReadFile(payloadPath) 62 | if err != nil { 63 | fmt.Printf("Error reading payload file %s: %v\n", payloadPath, err) 64 | return 65 | } 66 | 67 | resp, err := client.DeleteWorkload(payloadData, contentType) 68 | 69 | if err != nil { 70 | fmt.Printf("Error: %v\n", err) 71 | return 72 | } 73 | fmt.Println(resp) 74 | }, 75 | } 76 | 77 | func init() { 78 | rootCmd.AddCommand(deleteCmd) 79 | deleteCmd.AddCommand(deleteWorkloadCmd) 80 | 81 | // Here you will define your flags and configuration settings. 82 | 83 | // Cobra supports Persistent Flags which will work for this command 84 | // and all subcommands, e.g.: 85 | deleteWorkloadCmd.PersistentFlags().String("payload", "", "workload payload path") 86 | deleteWorkloadCmd.PersistentFlags().String("contentType", "", "Can be either json or yaml") 87 | 88 | // Cobra supports local flags which will only run when this command 89 | // is called directly, e.g.: 90 | // workloadCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") 91 | } 92 | -------------------------------------------------------------------------------- /cmd/docs.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | // Hidden CLI option to generate docs in docs/cli 4 | 5 | import ( 6 | "os" 7 | 8 | "github.com/spf13/cobra" 9 | "github.com/spf13/cobra/doc" 10 | ) 11 | 12 | const DOCS_DIR_CLI = "docs/references/cli" 13 | 14 | var docGenCmd = &cobra.Command{ 15 | Use: "docs-gen", 16 | Hidden: true, 17 | Short: "Generate markdown documentation for the CLI", 18 | RunE: func(cmd *cobra.Command, args []string) error { 19 | if err := os.RemoveAll(DOCS_DIR_CLI); err != nil { 20 | return err 21 | } 22 | 23 | if err := os.MkdirAll(DOCS_DIR_CLI, 0755); err != nil { 24 | return err 25 | } 26 | 27 | return doc.GenMarkdownTree(rootCmd, DOCS_DIR_CLI) 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /cmd/list.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2025 NAME HERE 3 | */ 4 | package cmd 5 | 6 | import ( 7 | "fmt" 8 | "os" 9 | 10 | "github.com/cedana/cedana-cli/client" 11 | "github.com/cedana/cedana-cli/pkg/flags" 12 | "github.com/cedana/cedana/pkg/style" 13 | "github.com/jedib0t/go-pretty/v6/table" 14 | "github.com/spf13/cobra" 15 | ) 16 | 17 | // Parent list command 18 | var listCmd = &cobra.Command{ 19 | Use: "list", 20 | Short: "List all existing components of a resource", 21 | Args: cobra.ArbitraryArgs, 22 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error { 23 | return nil 24 | }, 25 | } 26 | 27 | var listClusterCmd = &cobra.Command{ 28 | Use: "cluster", 29 | Short: "List all active managed clusters for the organization", 30 | Run: func(cmd *cobra.Command, args []string) { 31 | clusters, err := client.ListClusters() 32 | if err != nil { 33 | fmt.Printf("Error: %v\n", err) 34 | return 35 | } 36 | 37 | // TODO pretty print 38 | fmt.Printf("Found %d clusters:\n", len(clusters)) 39 | for _, cluster := range clusters { 40 | fmt.Printf("- %s: %s\n", cluster.Name, cluster.ID) 41 | } 42 | }, 43 | } 44 | 45 | var listNodeCmd = &cobra.Command{ 46 | Use: "node", 47 | Short: "List all existing nodes under given cluster", 48 | Aliases: []string{"ls"}, 49 | Args: cobra.NoArgs, 50 | RunE: func(cmd *cobra.Command, args []string) error { 51 | clusterName, err := cmd.Flags().GetString("cluster") 52 | if err != nil { 53 | return fmt.Errorf("failed to get cluster flag: %w", err) 54 | } 55 | 56 | nodes, err := client.GetClusterNodes(clusterName) 57 | if err != nil { 58 | return err 59 | } 60 | 61 | if len(nodes) == 0 { 62 | fmt.Println("No nodes to show") 63 | return nil 64 | } 65 | 66 | tableWriter := table.NewWriter() 67 | tableWriter.SetStyle(style.TableStyle) 68 | tableWriter.SetOutputMirror(os.Stdout) 69 | tableWriter.Style().Options.SeparateRows = false 70 | 71 | tableWriter.AppendHeader(table.Row{ 72 | "Name", 73 | "Instance Type", 74 | "ID", 75 | }) 76 | 77 | for _, node := range nodes { 78 | tableWriter.AppendRow(table.Row{ 79 | node.Name, 80 | node.InstanceType, 81 | node.ID, 82 | }) 83 | } 84 | 85 | tableWriter.Render() 86 | 87 | fmt.Printf("\n%d nodes found\n", len(nodes)) 88 | return nil 89 | }, 90 | } 91 | 92 | // podCmd represents the pod command 93 | var listPodCmd = &cobra.Command{ 94 | Use: "pod", 95 | Short: "List all existing pods under given namespace of a cluster", 96 | Long: `List all existing pods of a given cluster under a specific namespace.`, 97 | Run: func(cmd *cobra.Command, args []string) { 98 | clusterName, err := cmd.Flags().GetString("cluster") 99 | if err != nil { 100 | fmt.Printf("Error retrieving cluster flag: %v\n", err) 101 | return 102 | } 103 | clusterNamespace, err := cmd.Flags().GetString("namespace") 104 | if err != nil { 105 | fmt.Printf("Error retrieving namespace flag: %v\n", err) 106 | return 107 | } 108 | pods, err := client.GetClusterPods(clusterName, clusterNamespace) 109 | if err != nil { 110 | fmt.Printf("Error: %v\n", err) 111 | return 112 | } 113 | fmt.Printf("Found %d pods in namespace %s :\n", len(pods), clusterNamespace) 114 | for _, pod := range pods { 115 | fmt.Printf("%s : %s\n", 116 | pod.Name, 117 | // pod.ID, 118 | // pod.Namespace, 119 | pod.Status, 120 | // pod.NodeID, 121 | ) 122 | } 123 | }, 124 | } 125 | 126 | func init() { 127 | rootCmd.AddCommand(listCmd) 128 | listCmd.AddCommand(listPodCmd) 129 | listCmd.AddCommand(listClusterCmd) 130 | listCmd.AddCommand(listNodeCmd) 131 | 132 | listPodCmd.PersistentFlags(). 133 | StringP(flags.ClusterFlag.Full, flags.ClusterFlag.Short, "", "cluster name") 134 | listNodeCmd.PersistentFlags(). 135 | StringP(flags.ClusterFlag.Full, flags.ClusterFlag.Short, "", "cluster name") 136 | 137 | listPodCmd.PersistentFlags(). 138 | StringP(flags.NamespaceFlag.Full, flags.NamespaceFlag.Short, "", "namespace") 139 | listNodeCmd.PersistentFlags(). 140 | StringP(flags.NamespaceFlag.Full, flags.NamespaceFlag.Short, "", "namespace") 141 | } 142 | -------------------------------------------------------------------------------- /cmd/root.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/cedana/cedana-cli/pkg/config" 8 | "github.com/cedana/cedana-cli/pkg/flags" 9 | "github.com/cedana/cedana-cli/pkg/logging" 10 | "github.com/rs/zerolog/log" 11 | "github.com/spf13/cobra" 12 | ) 13 | 14 | // init initializes the command and flags 15 | func init() { 16 | cobra.EnableTraverseRunHooks = true 17 | 18 | rootCmd.AddCommand(docGenCmd) 19 | 20 | // Add root flags 21 | rootCmd.PersistentFlags(). 22 | String(flags.ConfigFlag.Full, "", "one-time config JSON string (merge with existing config)") 23 | rootCmd.PersistentFlags().String(flags.ConfigDirFlag.Full, "", "custom config directory") 24 | rootCmd.MarkPersistentFlagDirname(flags.ConfigDirFlag.Full) 25 | rootCmd.MarkFlagsMutuallyExclusive(flags.ConfigFlag.Full, flags.ConfigDirFlag.Full) 26 | } 27 | 28 | var ( 29 | // Used for flags. 30 | rootCmd = &cobra.Command{ 31 | Use: "cedana-cli", 32 | Short: "Instance brokerage and orchestration system for Cedana", 33 | Long: ` 34 | ________ _______ ________ ________ ________ ________ 35 | |\ ____\|\ ___ \ |\ ___ \|\ __ \|\ ___ \|\ __ \ 36 | \ \ \___|\ \ __/|\ \ \_|\ \ \ \|\ \ \ \\ \ \ \ \|\ \ 37 | \ \ \ \ \ \_|/_\ \ \ \\ \ \ __ \ \ \\ \ \ \ __ \ 38 | \ \ \____\ \ \_|\ \ \ \_\\ \ \ \ \ \ \ \\ \ \ \ \ \ \ 39 | \ \_______\ \_______\ \_______\ \__\ \__\ \__\\ \__\ \__\ \__\ 40 | \|_______|\|_______|\|_______|\|__|\|__|\|__| \|__|\|__|\|__| 41 | 42 | ` + 43 | "\n Instance Brokerage, Orchestration and Migration System for Cedana." + 44 | "\n Property of Cedana, Corp.\n", 45 | 46 | PersistentPreRunE: func(cmd *cobra.Command, args []string) error { 47 | conf, _ := cmd.Flags().GetString(flags.ConfigFlag.Full) 48 | confDir, _ := cmd.Flags().GetString(flags.ConfigDirFlag.Full) 49 | if err := config.Init(config.InitArgs{ 50 | Config: conf, 51 | ConfigDir: confDir, 52 | }); err != nil { 53 | return fmt.Errorf("Failed to initialize config: %w", err) 54 | } 55 | 56 | logging.SetLevel(config.Global.LogLevel) 57 | 58 | return nil 59 | }, 60 | } 61 | ) 62 | 63 | func Execute(ctx context.Context, version string) error { 64 | ctx = log.With().Str("context", "cmd").Logger().WithContext(ctx) 65 | 66 | rootCmd.Version = version 67 | rootCmd.Long = rootCmd.Long + "\n " + version 68 | rootCmd.SilenceUsage = true // only show usage when true usage error 69 | 70 | return rootCmd.ExecuteContext(ctx) 71 | } 72 | -------------------------------------------------------------------------------- /cmd/version.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // used in main.go to set version info 8 | func SetVersionInfo(version, commit, date string) { 9 | rootCmd.Version = fmt.Sprintf("%s (%s)", version, commit) 10 | } 11 | -------------------------------------------------------------------------------- /docs/.gitbook/assets/image (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedana/cedana-cli/558a0bfc191e329118c220dfe6ab83d6318ad95c/docs/.gitbook/assets/image (1).png -------------------------------------------------------------------------------- /docs/.gitbook/assets/workload 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedana/cedana-cli/558a0bfc191e329118c220dfe6ab83d6318ad95c/docs/.gitbook/assets/workload 1.png -------------------------------------------------------------------------------- /docs/.gitbook/assets/workload 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedana/cedana-cli/558a0bfc191e329118c220dfe6ab83d6318ad95c/docs/.gitbook/assets/workload 2.png -------------------------------------------------------------------------------- /docs/.gitbook/assets/workload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedana/cedana-cli/558a0bfc191e329118c220dfe6ab83d6318ad95c/docs/.gitbook/assets/workload.png -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Cedana CLI 2 | 3 |
4 | 5 | Welcome to our CLI documentation! 6 | 7 | The cedana CLI serves as the interface to our managed service, allowing you to deploy, inspect and manage workloads. We use Kueue extensively in the background to effectively schedule workloads, while running our Kubernetes controller in the background to seamlessly rebalance your HPC, ML or otherwise computation-heavy workloads with no interruptions. 8 | 9 | For detailed documentation on installing our managed Kubernetes or the larger Cedana ecosystem, please see [here](https://docs.cedana.ai). 10 | 11 | ### Quick start 12 | 13 | First, ensure that you have Cedana CLI installed on your machine. See [installation](get-started/installation.md). 14 | 15 | For all available CLI options, see [CLI reference](references/cli/cedana-cli.md). 16 | 17 | ### Get started 18 | 19 | * [Installation](get-started/installation.md) 20 | * [Authentication](get-started/authentication.md) 21 | 22 | ### References 23 | 24 | * [CLI reference](references/cli/cedana.md) 25 | -------------------------------------------------------------------------------- /docs/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Table of contents 2 | 3 | * [Cedana CLI](README.md) 4 | 5 | ## Get started 6 | 7 | * [Installation](get-started/installation.md) 8 | * [Authentication](get-started/authentication.md) 9 | * [Configuration](get-started/config.md) 10 | 11 | ## Examples 12 | * [Scheduling a Single GROMACS Workload](examples/gromacs.md) 13 | * [Scheduling Hundreds of Workloads ](examples/gromacs-creation-automation.md) 14 | 15 | ## Guides 16 | * [Workload Scheduling Mechanism](guides/workload-management.md) 17 | 18 | ## References 19 | * [CLI](references/cli/README.md) 20 | * [cedana-cli](references/cli/cedana-cli.md) 21 | * [Completion](references/cli/cedana-cli_completion.md) 22 | * [Bash](references/cli/cedana-cli_completion_bash.md) 23 | * [Fish](references/cli/cedana-cli_completion_fish.md) 24 | * [PowerShell](references/cli/cedana-cli_completion_powershell.md) 25 | * [Zsh](references/cli/cedana-cli_completion_zsh.md) 26 | * [Create](references/cli/cedana-cli_create.md) 27 | * [Workload](references/cli/cedana-cli_create_workload.md) 28 | * [Delete](references/cli/cedana-cli_delete.md) 29 | * [Workload](references/cli/cedana-cli_delete_workload.md) 30 | * [List](references/cli/cedana-cli_list.md) 31 | * [Cluster](references/cli/cedana-cli_list_cluster.md) 32 | * [Node](references/cli/cedana-cli_list_node.md) 33 | * [Pod](references/cli/cedana-cli_list_pod.md) 34 | * [GitHub](https://github.com/cedana/cedana-cli) 35 | -------------------------------------------------------------------------------- /docs/examples/gromacs-creation-automation.md: -------------------------------------------------------------------------------- 1 | # Scheduling 200+ GROMACS Workloads with Cedana 2 | 3 | ## Overview 4 | 5 | This documentation runs through an example using a script to effectively submit and manage large batches of molecular dynamics simulation workloads to Cedana from pdb files stored in AWS S3 storage. 6 | 7 | ## Prerequisites 8 | 9 | Before running the script, ensure you have the following: 10 | 11 | 1. AWS CLI installed and configured with `aws configure` to access the specified S3 bucket 12 | 2. Cedana CLI must be installed 13 | 3. A valid workload template file (`workload.yml`) containing placeholders (`WORKING_DIR` and `JOB_NAME`) in the same directory as the script 14 | 4. Proper directory structure in your S3 bucket with molecular dynamics simulation files 15 | 16 | ## Script Configuration 17 | 18 | ```bash 19 | #!/bin/bash 20 | 21 | BUCKET_NAME="your-bucket-name" 22 | PREFIX="gromacs_test/" 23 | WORKLOAD_CONFIG="./workload.yml" 24 | TEMP_WORKLOAD_CONFIG="./tmp-workload.yml" 25 | 26 | # Sanitize job names for Kubernetes 27 | sanitize_job_name() { 28 | local name="md-simul-${1//_/-}" # Replace _ with - 29 | name=$(echo "$name" | tr '[:upper:]' '[:lower:]') # Convert to lowercase 30 | name=$(echo "$name" | sed 's/--*/-/g' | sed 's/-$//') # Remove double hyphens & trailing hyphen 31 | echo "$name" 32 | } 33 | 34 | # Get folders from S3 35 | FOLDERS=$(aws s3 ls "s3://$BUCKET_NAME/$PREFIX" --recursive | awk '{print $NF}' | awk -F'/' 'NF>2 {print $2}' | sort -u) 36 | 37 | for folder in $FOLDERS; do 38 | echo "Processing folder: $folder" 39 | JOB_NAME=$(sanitize_job_name "$folder") 40 | # Create a temporary workload with right complex.pdb file by replacing placeholders 41 | sed -e "s|WORKING_DIR|$folder|g" -e "s|JOB_NAME|$JOB_NAME|g" "$WORKLOAD_CONFIG" > "$TEMP_WORKLOAD_CONFIG" 42 | # Submit job 43 | cedana-cli create workload --payload "$TEMP_WORKLOAD_CONFIG" --contentType yaml 44 | rm -f "$TEMP_WORKLOAD_CONFIG" 45 | done 46 | ``` 47 | 48 | The script uses the following default values that you may need to adjust: 49 | 50 | - `BUCKET_NAME="customer-simulation"`: The S3 bucket containing simulation data 51 | - `PREFIX="gromacs_test/"`: The prefix path within the bucket to search for simulation folders 52 | - `WORKLOAD_CONFIG="./workload.yml"`: Path to the template workload configuration 53 | 54 | ## Execution Process 55 | 56 | Sample workload.yml file: 57 | 58 | ```yaml 59 | cluster_name: your-eks-cluster 60 | workload: 61 | apiVersion: batch/v1 62 | kind: Job 63 | metadata: 64 | name: JOB_NAME 65 | namespace: cedana 66 | labels: 67 | kueue.x-k8s.io/queue-name: user-queue 68 | spec: 69 | template: 70 | spec: 71 | restartPolicy: Never 72 | volumes: 73 | - name: storage 74 | persistentVolumeClaim: 75 | claimName: s3-simulation-pvc 76 | containers: 77 | - name: gromacs 78 | image: gromacs/gromacs:latest 79 | resources: 80 | requests: 81 | cpu: "16" 82 | memory: "16Gi" 83 | limits: 84 | cpu: "32" 85 | memory: "32Gi" 86 | volumeMounts: 87 | - name: storage 88 | mountPath: /data 89 | command: ["/bin/bash", "-c"] 90 | args: 91 | - | 92 | set -ex # Exit on error and print commands 93 | cp -rf /data/gromacs_test /gromacs_test 94 | mkdir -p /gromacs_test 95 | cd /gromacs_test/WORKING_DIR 96 | gmx pdb2gmx -f "WORKING_DIR.pdb" -o prep_processed.gro -ff amber99sb -water tip3p 97 | gmx editconf -f prep_processed.gro -o prep_newbox.gro -bt dodecahedron -d 1.5 -c 98 | gmx solvate -cp prep_newbox.gro -cs spc216.gro -o prep_solv.gro -p topol.top 99 | gmx grompp -f ../ions.mdp -c prep_solv.gro -p topol.top -o ions.tpr 100 | echo "13" | gmx genion -s ions.tpr -o prep_solv_ions.gro -p topol.top -pname NA -nname CL -neutral 101 | gmx grompp -f ../em.mdp -c prep_solv_ions.gro -p topol.top -o em.tpr 102 | gmx mdrun -deffnm em 103 | echo -e "1\n0" | gmx trjconv -s em.tpr -f em.gro -o em_centered.gro -pbc mol -center 104 | gmx grompp -f ../nvt.mdp -c em_centered.gro -r em_centered.gro -p topol.top -o nvt.tpr 105 | gmx mdrun -deffnm nvt 106 | echo -e "1\n0" | gmx trjconv -s nvt.tpr -f nvt.gro -o nvt_centered.gro -pbc mol -center 107 | gmx grompp -f ../npt.mdp -c nvt_centered.gro -r nvt_centered.gro -t nvt.cpt -p topol.top -o npt.tpr 108 | cp -rf /gromacs_test /data/gromacs_output 109 | gmx mdrun -deffnm npt 110 | echo -e "1\n0" | gmx trjconv -s npt.tpr -f npt.gro -o npt_centered.gro -pbc mol -center 111 | python ../find_number.py 112 | { 113 | read receptor_start 114 | read receptor_end 115 | read ligand_start 116 | read ligand_end 117 | } < atom_number.txt 118 | gmx make_ndx -f npt_centered.gro -o index.ndx <<< "q" 119 | group_count=$(grep "\[" index.ndx | wc -l) 120 | echo -e "a ${receptor_start}-${receptor_end}\nname $((group_count)) receptor\na ${ligand_start}-${ligand_end}\nname $((group_count + 1)) ligand\nq" | gmx make_ndx -f npt_centered.gro -n index.ndx -o index.ndx 121 | gmx grompp -f ../md.mdp -c npt_centered.gro -t npt.cpt -p topol.top -n index.ndx -o md.tpr 122 | gmx mdrun -deffnm md 123 | echo -e "51\n52" | gmx energy -f md.edr -o interaction_energy.xvg 124 | cd .. 125 | cp -rf /gromacs_test/WORKING_DIR /data/gromacs_output/WORKING_DIR 126 | ``` 127 | 128 | To execute the script run: 129 | ```bash 130 | chmod +x create-workload.sh 131 | ./create-workload.sh 132 | ``` 133 | When run, the script will: 134 | 135 | 1. Connect to the specified S3 bucket and list all folders under the defined prefix 136 | 2. For each folder found: 137 | - Generate a workload name based on the folder name 138 | - Create a temporary workload configuration file with the appropriate substitutions 139 | - Submit the workload to Cedana using the Cedana CLI 140 | - Remove the temporary workload file 141 | 142 | ## Deleting Workloads 143 | 144 | To delete previously scheduled workloads, use the same script with a modified command. Simply replace `create` with `delete` in the Cedana CLI command: 145 | 146 | ```bash 147 | cedana-cli delete workload --payload "$TEMP_WORKLOAD_CONFIG" --contentType yaml 148 | ``` 149 | 150 | ## Troubleshooting 151 | 152 | - Ensure AWS CLI credentials are correctly configured 153 | - Verify the S3 bucket name and prefix are accurate 154 | - Confirm that the `workload.yml` template file contains the correct placeholders (`WORKING_DIR` and `JOB_NAME`) 155 | - Check that Cedana CLI is properly installed and authenticated 156 | 157 | ## Additional Notes 158 | 159 | The script sanitizes folder names for Kubernetes compatibility by: 160 | - Converting underscores to hyphens 161 | - Changing all characters to lowercase 162 | - Removing consecutive hyphens and trailing hyphens 163 | -------------------------------------------------------------------------------- /docs/examples/gromacs.md: -------------------------------------------------------------------------------- 1 | We've built some examples demonstrating scheduling workloads to help you quickly understand and implement our CLI tool. 2 | 3 | # Creating Workloads 4 | 5 | ## Running GROMACS 6 | 7 | To create a workload, you need to specify a payload file. This json file will consist of the cluster name you want to schedule the workload into and the kubernetes job payload you would like to schedule. 8 | 9 | ```bash 10 | cedana-cli create workload --payload simulation-workload.json 11 | ``` 12 | The below simulation-workload.json can be used to test out the above command. 13 | 14 | ```json 15 | { "cluster_name": "", 16 | "workload": { 17 | "apiVersion": "batch/v1", 18 | "kind": "Job", 19 | "metadata": { 20 | "name": "gromacs-md-simulation", 21 | "namespace": "cedana", 22 | "labels": { 23 | "kueue.x-k8s.io/queue-name": "user-queue" 24 | } 25 | }, 26 | "spec": { 27 | "template": { 28 | "spec": { 29 | "restartPolicy": "Never", 30 | "volumes": [ 31 | { 32 | "name": "storage", 33 | "persistentVolumeClaim": { 34 | "claimName": "s3-simulation-pvc" 35 | } 36 | } 37 | ], 38 | "containers": [ 39 | { 40 | "name": "gromacs", 41 | "image": "gromacs/gromacs:latest", 42 | "volumeMounts": [ 43 | { 44 | "name": "storage", 45 | "mountPath": "/data" 46 | } 47 | ], 48 | "resources": { 49 | "requests": { 50 | "cpu": "8", 51 | "memory": "4Gi" 52 | }, 53 | "limits": { 54 | "cpu": "32", 55 | "memory": "32Gi" 56 | } 57 | }, 58 | "command": ["/bin/bash", "-c"], 59 | "args": [ 60 | "set -ex; gmx pdb2gmx -f /data/complex.pdb -o complex_processed.gro -ff amber99sb -water tip3p; gmx editconf -f complex_processed.gro -o complex_newbox.gro -bt dodecahedron -d 1.0; echo \"17\" | gmx solvate -cp complex_newbox.gro -cs spc216.gro -o complex_solv.gro -p topol.top; gmx grompp -f /data/ions.mdp -c complex_solv.gro -p topol.top -o ions.tpr; echo \"13\" | gmx genion -s ions.tpr -o complex_solv_ions.gro -p topol.top -pname NA -nname CL -neutral;....." ] 61 | } 62 | ] 63 | } 64 | } 65 | } 66 | } 67 | } 68 | ``` 69 | 70 | # Deleting Workloads 71 | 72 | To delete a workload, use the same payload as specified in create. 73 | 74 | ```bash 75 | cedana-cli delete workload --payload simulation-workload.json 76 | ``` 77 | 78 | # Listing Workloads 79 | 80 | Let's make sure that we have a cluster running to schedule new workloads into. 81 | 82 | ```bash 83 | cedana-cli list cluster 84 | ``` 85 | 86 | Workloads spawn pods which can be listed through the following command: 87 | 88 | ```bash 89 | cedana-cli list pod --cluster --namespace cedana 90 | ``` 91 | 92 | All workloads are created under the cedana namespace, and have their lifecycles managed in the background. 93 | -------------------------------------------------------------------------------- /docs/get-started/authentication.md: -------------------------------------------------------------------------------- 1 | ## Authentication 2 | 3 | Create an account at [auth.cedana.com](https://auth.cedana.com). 4 | 5 | Once logged in, you'll be redirected to an account management page, where you can create an API key. If you've logged in via your organization's email address; you'll be able to create and manage organization-wide API keys as well. 6 | 7 | Once you have obtained an API key, export the following variables: 8 | 9 | ``` 10 | export CEDANA_URL="https://.cedana.ai/v1" 11 | export CEDANA_AUTH_TOKEN= 12 | ``` 13 | 14 | You should have received a unique URL for your organization. 15 | -------------------------------------------------------------------------------- /docs/get-started/config.md: -------------------------------------------------------------------------------- 1 | # Configuration 2 | 3 | `cedana-cli` configuration lives in in ~/.cedana/cli-config.json. This file is automatically created the first time you use a `cedana-cli` command. You can also create it manually. 4 | 5 | You may also override the configuration using environment variables. The environment variables are prefixed with `CEDANA_CLI` and are in uppercase. For example, `connection.url` can be set with `CEDANA_CLI_CONNECTION_URL`. 6 | 7 | 8 | ```go 9 | type ( 10 | // Cedana configuration. Each of the below fields can also be set 11 | // through an environment variable with the same name, prefixed, and in uppercase. E.g. 12 | // `Metrics.ASR` can be set with `CEDANA_METRICS_ASR`. The `env_aliases` tag below specifies 13 | // alternative (alias) environment variable names (comma-separated). 14 | Config struct { 15 | // LogLevel is the default log level used by the server 16 | LogLevel string `json:"log_level" key:"log_level" yaml:"log_level" mapstructure:"log_level"` 17 | // Connection settings 18 | Connection Connection `json:"connection" key:"connection" yaml:"connection" mapstructure:"connection"` 19 | } 20 | 21 | Connection struct { 22 | // URL is your unique Cedana endpoint URL 23 | URL string `json:"url" key:"url" yaml:"url" mapstructure:"url" env_aliases:"CEDANA_URL"` 24 | // AuthToken is your authentication token for the Cedana endpoint 25 | AuthToken string `json:"auth_token" key:"auth_token" yaml:"auth_token" mapstructure:"auth_token" env_aliases:"CEDANA_AUTH_TOKEN"` 26 | } 27 | ) 28 | ``` 29 | -------------------------------------------------------------------------------- /docs/get-started/installation.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | Install from source for running the latest version of cedana-cli. 4 | 5 | ## Build from source 6 | 7 | Clone the cedana-cli repository 8 | 9 | ``` 10 | git clone https://github.com/cedana/cedana-cli.git 11 | ``` 12 | 13 | To build and install to path: 14 | 15 | ```sh 16 | make 17 | ``` 18 | 19 | To build: 20 | 21 | ```sh 22 | make build 23 | ``` 24 | 25 | To install to path: 26 | 27 | ```sh 28 | make install 29 | ``` 30 | -------------------------------------------------------------------------------- /docs/guides/workload-management.md: -------------------------------------------------------------------------------- 1 | This is a comprehensive guide detailing Cedana's current managed workload creation, automation, and management framework. 2 | Key infrastructure design priorities: 3 | 4 | - Auto-scaling architecture supporting various AMIs with targeted CPU/GPU instance selection 5 | - Queue-based job scheduling system utilizing Kueue for customer workloads, controller-initiated with future propagator triggering for multi-cluster support 6 | - Automated node migration with checkpoint restoration and spot interruption handling (in development) 7 | 8 | 9 | # Design 10 | 11 | Some of the components involved in the system include: 12 | 13 | - Nodepool: Refers to an Ec2NodeClass kubernetes resource kind. 14 | - Ec2 Node Class: Contains specifications such as ami, instance-type, and other ec2 instance related information. 15 | - Local Queue: A queue scoped to a specific namespace, used by workloads to request resources. 16 | - Cluster Queue: A global queue that aggregates multiple local queues, managing resource allocation at the cluster level. 17 | - Workload: A representation of a job or task that needs resources and waits in a queue until resources are available. 18 | 19 |

20 | 21 | We also allow you to store and access files running inside your workload through s3 bucket volume mounts. 22 | 23 | ## Final Design 24 | 25 | Here we create two workloads. Since the clusterqueue resource limit is set to 64 cores and the job requests 32 cores each, We are able to admit two jobs based on the configuration. The pods are in pending state waiting for karpenter nodepool to spin up nodes. 26 | 27 |

28 | 29 | On creating a third job, you will notice that it gets listed onto `pending` Workloads. You will also notice that the gromacs job is in `suspended` state, therefore no pod is spawned and nodepool will not be triggered to create a new instance. Once the previous two jobs complete we schedule the third job in one of running instances. 30 | 31 |

32 | 33 | ## Alternatives Considered 34 | 35 | - Cluster autoscaler: This is an alternative to Karpenter. One main issue with using cluster autoscaler is granularity. While cluster autoscaler requires us to create managed node groups and only then scale nodes based on requirement, Karpenter creates nodes based on requirement and assigns an adequate instance type (as specified in ec2nodeclass) 36 | 37 | # References 38 | 39 | - [https://karpenter.sh/docs/concepts/nodepools/](https://karpenter.sh/docs/concepts/nodepools/) 40 | - [https://kueue.sigs.k8s.io/docs/concepts/](https://kueue.sigs.k8s.io/docs/concepts/) 41 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli 2 | 3 | Instance brokerage and orchestration system for Cedana 4 | 5 | ### Synopsis 6 | 7 | 8 | ________ _______ ________ ________ ________ ________ 9 | |\ ____\|\ ___ \ |\ ___ \|\ __ \|\ ___ \|\ __ \ 10 | \ \ \___|\ \ __/|\ \ \_|\ \ \ \|\ \ \ \\ \ \ \ \|\ \ 11 | \ \ \ \ \ \_|/_\ \ \ \\ \ \ __ \ \ \\ \ \ \ __ \ 12 | \ \ \____\ \ \_|\ \ \ \_\\ \ \ \ \ \ \ \\ \ \ \ \ \ \ 13 | \ \_______\ \_______\ \_______\ \__\ \__\ \__\\ \__\ \__\ \__\ 14 | \|_______|\|_______|\|_______|\|__|\|__|\|__| \|__|\|__|\|__| 15 | 16 | 17 | Instance Brokerage, Orchestration and Migration System for Cedana. 18 | Property of Cedana, Corp. 19 | 20 | dev 21 | 22 | ### Options 23 | 24 | ``` 25 | --config string one-time config JSON string (merge with existing config) 26 | --config-dir string custom config directory 27 | -h, --help help for cedana-cli 28 | ``` 29 | 30 | ### SEE ALSO 31 | 32 | * [cedana-cli completion](cedana-cli_completion.md) - Generate the autocompletion script for the specified shell 33 | * [cedana-cli create](cedana-cli_create.md) - Create a new resource 34 | * [cedana-cli delete](cedana-cli_delete.md) - Delete an existing resource 35 | * [cedana-cli list](cedana-cli_list.md) - List all existing components of a resource 36 | 37 | ###### Auto generated by spf13/cobra on 3-Apr-2025 38 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_completion.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli completion 2 | 3 | Generate the autocompletion script for the specified shell 4 | 5 | ### Synopsis 6 | 7 | Generate the autocompletion script for cedana-cli for the specified shell. 8 | See each sub-command's help for details on how to use the generated script. 9 | 10 | 11 | ### Options 12 | 13 | ``` 14 | -h, --help help for completion 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --config string one-time config JSON string (merge with existing config) 21 | --config-dir string custom config directory 22 | ``` 23 | 24 | ### SEE ALSO 25 | 26 | * [cedana-cli](cedana-cli.md) - Instance brokerage and orchestration system for Cedana 27 | * [cedana-cli completion bash](cedana-cli_completion_bash.md) - Generate the autocompletion script for bash 28 | * [cedana-cli completion fish](cedana-cli_completion_fish.md) - Generate the autocompletion script for fish 29 | * [cedana-cli completion powershell](cedana-cli_completion_powershell.md) - Generate the autocompletion script for powershell 30 | * [cedana-cli completion zsh](cedana-cli_completion_zsh.md) - Generate the autocompletion script for zsh 31 | 32 | ###### Auto generated by spf13/cobra on 3-Apr-2025 33 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_completion_bash.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli completion bash 2 | 3 | Generate the autocompletion script for bash 4 | 5 | ### Synopsis 6 | 7 | Generate the autocompletion script for the bash shell. 8 | 9 | This script depends on the 'bash-completion' package. 10 | If it is not installed already, you can install it via your OS's package manager. 11 | 12 | To load completions in your current shell session: 13 | 14 | source <(cedana-cli completion bash) 15 | 16 | To load completions for every new session, execute once: 17 | 18 | #### Linux: 19 | 20 | cedana-cli completion bash > /etc/bash_completion.d/cedana-cli 21 | 22 | #### macOS: 23 | 24 | cedana-cli completion bash > $(brew --prefix)/etc/bash_completion.d/cedana-cli 25 | 26 | You will need to start a new shell for this setup to take effect. 27 | 28 | 29 | ``` 30 | cedana-cli completion bash 31 | ``` 32 | 33 | ### Options 34 | 35 | ``` 36 | -h, --help help for bash 37 | --no-descriptions disable completion descriptions 38 | ``` 39 | 40 | ### Options inherited from parent commands 41 | 42 | ``` 43 | --config string one-time config JSON string (merge with existing config) 44 | --config-dir string custom config directory 45 | ``` 46 | 47 | ### SEE ALSO 48 | 49 | * [cedana-cli completion](cedana-cli_completion.md) - Generate the autocompletion script for the specified shell 50 | 51 | ###### Auto generated by spf13/cobra on 3-Apr-2025 52 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_completion_fish.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli completion fish 2 | 3 | Generate the autocompletion script for fish 4 | 5 | ### Synopsis 6 | 7 | Generate the autocompletion script for the fish shell. 8 | 9 | To load completions in your current shell session: 10 | 11 | cedana-cli completion fish | source 12 | 13 | To load completions for every new session, execute once: 14 | 15 | cedana-cli completion fish > ~/.config/fish/completions/cedana-cli.fish 16 | 17 | You will need to start a new shell for this setup to take effect. 18 | 19 | 20 | ``` 21 | cedana-cli completion fish [flags] 22 | ``` 23 | 24 | ### Options 25 | 26 | ``` 27 | -h, --help help for fish 28 | --no-descriptions disable completion descriptions 29 | ``` 30 | 31 | ### Options inherited from parent commands 32 | 33 | ``` 34 | --config string one-time config JSON string (merge with existing config) 35 | --config-dir string custom config directory 36 | ``` 37 | 38 | ### SEE ALSO 39 | 40 | * [cedana-cli completion](cedana-cli_completion.md) - Generate the autocompletion script for the specified shell 41 | 42 | ###### Auto generated by spf13/cobra on 3-Apr-2025 43 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_completion_powershell.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli completion powershell 2 | 3 | Generate the autocompletion script for powershell 4 | 5 | ### Synopsis 6 | 7 | Generate the autocompletion script for powershell. 8 | 9 | To load completions in your current shell session: 10 | 11 | cedana-cli completion powershell | Out-String | Invoke-Expression 12 | 13 | To load completions for every new session, add the output of the above command 14 | to your powershell profile. 15 | 16 | 17 | ``` 18 | cedana-cli completion powershell [flags] 19 | ``` 20 | 21 | ### Options 22 | 23 | ``` 24 | -h, --help help for powershell 25 | --no-descriptions disable completion descriptions 26 | ``` 27 | 28 | ### Options inherited from parent commands 29 | 30 | ``` 31 | --config string one-time config JSON string (merge with existing config) 32 | --config-dir string custom config directory 33 | ``` 34 | 35 | ### SEE ALSO 36 | 37 | * [cedana-cli completion](cedana-cli_completion.md) - Generate the autocompletion script for the specified shell 38 | 39 | ###### Auto generated by spf13/cobra on 3-Apr-2025 40 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_completion_zsh.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli completion zsh 2 | 3 | Generate the autocompletion script for zsh 4 | 5 | ### Synopsis 6 | 7 | Generate the autocompletion script for the zsh shell. 8 | 9 | If shell completion is not already enabled in your environment you will need 10 | to enable it. You can execute the following once: 11 | 12 | echo "autoload -U compinit; compinit" >> ~/.zshrc 13 | 14 | To load completions in your current shell session: 15 | 16 | source <(cedana-cli completion zsh) 17 | 18 | To load completions for every new session, execute once: 19 | 20 | #### Linux: 21 | 22 | cedana-cli completion zsh > "${fpath[1]}/_cedana-cli" 23 | 24 | #### macOS: 25 | 26 | cedana-cli completion zsh > $(brew --prefix)/share/zsh/site-functions/_cedana-cli 27 | 28 | You will need to start a new shell for this setup to take effect. 29 | 30 | 31 | ``` 32 | cedana-cli completion zsh [flags] 33 | ``` 34 | 35 | ### Options 36 | 37 | ``` 38 | -h, --help help for zsh 39 | --no-descriptions disable completion descriptions 40 | ``` 41 | 42 | ### Options inherited from parent commands 43 | 44 | ``` 45 | --config string one-time config JSON string (merge with existing config) 46 | --config-dir string custom config directory 47 | ``` 48 | 49 | ### SEE ALSO 50 | 51 | * [cedana-cli completion](cedana-cli_completion.md) - Generate the autocompletion script for the specified shell 52 | 53 | ###### Auto generated by spf13/cobra on 3-Apr-2025 54 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_create.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli create 2 | 3 | Create a new resource 4 | 5 | ### Synopsis 6 | 7 | Create a new resource with a json payload 8 | 9 | ``` 10 | cedana-cli create [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for create 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --config string one-time config JSON string (merge with existing config) 23 | --config-dir string custom config directory 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [cedana-cli](cedana-cli.md) - Instance brokerage and orchestration system for Cedana 29 | * [cedana-cli create workload](cedana-cli_create_workload.md) - Create a new workload 30 | 31 | ###### Auto generated by spf13/cobra on 3-Apr-2025 32 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_create_workload.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli create workload 2 | 3 | Create a new workload 4 | 5 | ### Synopsis 6 | 7 | Create a new workload with the provided configuration. 8 | 9 | ``` 10 | cedana-cli create workload [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | --contentType string Can be either json or yaml 17 | -h, --help help for workload 18 | --payload string workload payload path 19 | ``` 20 | 21 | ### Options inherited from parent commands 22 | 23 | ``` 24 | --config string one-time config JSON string (merge with existing config) 25 | --config-dir string custom config directory 26 | ``` 27 | 28 | ### SEE ALSO 29 | 30 | * [cedana-cli create](cedana-cli_create.md) - Create a new resource 31 | 32 | ###### Auto generated by spf13/cobra on 3-Apr-2025 33 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_delete.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli delete 2 | 3 | Delete an existing resource 4 | 5 | ### Synopsis 6 | 7 | Delete an existing resource with the provided configuration. 8 | 9 | ``` 10 | cedana-cli delete [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -h, --help help for delete 17 | ``` 18 | 19 | ### Options inherited from parent commands 20 | 21 | ``` 22 | --config string one-time config JSON string (merge with existing config) 23 | --config-dir string custom config directory 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | * [cedana-cli](cedana-cli.md) - Instance brokerage and orchestration system for Cedana 29 | * [cedana-cli delete workload](cedana-cli_delete_workload.md) - Delete a running workload 30 | 31 | ###### Auto generated by spf13/cobra on 3-Apr-2025 32 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_delete_workload.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli delete workload 2 | 3 | Delete a running workload 4 | 5 | ### Synopsis 6 | 7 | Delete a running workload with the provided configuration. 8 | 9 | ``` 10 | cedana-cli delete workload [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | --contentType string Can be either json or yaml 17 | -h, --help help for workload 18 | --payload string workload payload path 19 | ``` 20 | 21 | ### Options inherited from parent commands 22 | 23 | ``` 24 | --config string one-time config JSON string (merge with existing config) 25 | --config-dir string custom config directory 26 | ``` 27 | 28 | ### SEE ALSO 29 | 30 | * [cedana-cli delete](cedana-cli_delete.md) - Delete an existing resource 31 | 32 | ###### Auto generated by spf13/cobra on 3-Apr-2025 33 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_list.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli list 2 | 3 | List all existing components of a resource 4 | 5 | ### Options 6 | 7 | ``` 8 | -h, --help help for list 9 | ``` 10 | 11 | ### Options inherited from parent commands 12 | 13 | ``` 14 | --config string one-time config JSON string (merge with existing config) 15 | --config-dir string custom config directory 16 | ``` 17 | 18 | ### SEE ALSO 19 | 20 | * [cedana-cli](cedana-cli.md) - Instance brokerage and orchestration system for Cedana 21 | * [cedana-cli list cluster](cedana-cli_list_cluster.md) - List all active managed clusters for the organization 22 | * [cedana-cli list node](cedana-cli_list_node.md) - List all existing nodes under given cluster 23 | * [cedana-cli list pod](cedana-cli_list_pod.md) - List all existing pods under given namespace of a cluster 24 | 25 | ###### Auto generated by spf13/cobra on 3-Apr-2025 26 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_list_cluster.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli list cluster 2 | 3 | List all active managed clusters for the organization 4 | 5 | ``` 6 | cedana-cli list cluster [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -h, --help help for cluster 13 | ``` 14 | 15 | ### Options inherited from parent commands 16 | 17 | ``` 18 | --config string one-time config JSON string (merge with existing config) 19 | --config-dir string custom config directory 20 | ``` 21 | 22 | ### SEE ALSO 23 | 24 | * [cedana-cli list](cedana-cli_list.md) - List all existing components of a resource 25 | 26 | ###### Auto generated by spf13/cobra on 3-Apr-2025 27 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_list_node.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli list node 2 | 3 | List all existing nodes under given cluster 4 | 5 | ``` 6 | cedana-cli list node [flags] 7 | ``` 8 | 9 | ### Options 10 | 11 | ``` 12 | -c, --cluster string cluster name 13 | -h, --help help for node 14 | -n, --namespace string namespace 15 | ``` 16 | 17 | ### Options inherited from parent commands 18 | 19 | ``` 20 | --config string one-time config JSON string (merge with existing config) 21 | --config-dir string custom config directory 22 | ``` 23 | 24 | ### SEE ALSO 25 | 26 | * [cedana-cli list](cedana-cli_list.md) - List all existing components of a resource 27 | 28 | ###### Auto generated by spf13/cobra on 3-Apr-2025 29 | -------------------------------------------------------------------------------- /docs/references/cli/cedana-cli_list_pod.md: -------------------------------------------------------------------------------- 1 | ## cedana-cli list pod 2 | 3 | List all existing pods under given namespace of a cluster 4 | 5 | ### Synopsis 6 | 7 | List all existing pods of a given cluster under a specific namespace. 8 | 9 | ``` 10 | cedana-cli list pod [flags] 11 | ``` 12 | 13 | ### Options 14 | 15 | ``` 16 | -c, --cluster string cluster name 17 | -h, --help help for pod 18 | -n, --namespace string namespace 19 | ``` 20 | 21 | ### Options inherited from parent commands 22 | 23 | ``` 24 | --config string one-time config JSON string (merge with existing config) 25 | --config-dir string custom config directory 26 | ``` 27 | 28 | ### SEE ALSO 29 | 30 | * [cedana-cli list](cedana-cli_list.md) - List all existing components of a resource 31 | 32 | ###### Auto generated by spf13/cobra on 3-Apr-2025 33 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/cedana/cedana-cli 2 | 3 | go 1.22.7 4 | 5 | toolchain go1.23.4 6 | 7 | require ( 8 | buf.build/gen/go/cedana/cedana/protocolbuffers/go v1.36.5-20250226205333-5d0820253730.1 // indirect 9 | buf.build/gen/go/cedana/criu/protocolbuffers/go v1.36.5-20250226205333-4b6f9efc37ef.1 // indirect 10 | github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect 11 | github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect 12 | github.com/ebitengine/purego v0.8.1 // indirect 13 | github.com/fsnotify/fsnotify v1.8.0 // indirect 14 | github.com/go-ole/go-ole v1.2.6 // indirect 15 | github.com/go-openapi/errors v0.22.0 // indirect 16 | github.com/go-openapi/strfmt v0.23.0 // indirect 17 | github.com/go-viper/mapstructure/v2 v2.2.1 // indirect 18 | github.com/google/uuid v1.6.0 // indirect 19 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 20 | github.com/jedib0t/go-pretty v4.3.0+incompatible // indirect 21 | github.com/jedib0t/go-pretty/v6 v6.6.7 // indirect 22 | github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect 23 | github.com/mattn/go-colorable v0.1.13 // indirect 24 | github.com/mattn/go-isatty v0.0.19 // indirect 25 | github.com/mattn/go-runewidth v0.0.16 // indirect 26 | github.com/mdlayher/socket v0.4.1 // indirect 27 | github.com/mdlayher/vsock v1.2.1 // indirect 28 | github.com/mitchellh/mapstructure v1.5.0 // indirect 29 | github.com/moby/sys/mountinfo v0.7.1 // indirect 30 | github.com/oklog/ulid v1.3.1 // indirect 31 | github.com/pelletier/go-toml/v2 v2.2.3 // indirect 32 | github.com/pierrec/lz4 v2.6.1+incompatible // indirect 33 | github.com/pkg/errors v0.9.1 // indirect 34 | github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect 35 | github.com/rivo/uniseg v0.4.7 // indirect 36 | github.com/russross/blackfriday/v2 v2.1.0 // indirect 37 | github.com/sagikazarmark/locafero v0.7.0 // indirect 38 | github.com/shirou/gopsutil/v4 v4.24.11 // indirect 39 | github.com/sourcegraph/conc v0.3.0 // indirect 40 | github.com/spf13/afero v1.12.0 // indirect 41 | github.com/spf13/cast v1.7.1 // indirect 42 | github.com/spf13/pflag v1.0.6 // indirect 43 | github.com/spf13/viper v1.20.0 // indirect 44 | github.com/subosito/gotenv v1.6.0 // indirect 45 | github.com/tklauser/go-sysconf v0.3.12 // indirect 46 | github.com/tklauser/numcpus v0.6.1 // indirect 47 | github.com/xeonx/timeago v1.0.0-rc5 // indirect 48 | github.com/yusufpapurcu/wmi v1.2.4 // indirect 49 | go.mongodb.org/mongo-driver v1.14.0 // indirect 50 | go.uber.org/atomic v1.9.0 // indirect 51 | go.uber.org/multierr v1.9.0 // indirect 52 | golang.org/x/net v0.33.0 // indirect 53 | golang.org/x/sync v0.11.0 // indirect 54 | golang.org/x/sys v0.30.0 // indirect 55 | golang.org/x/text v0.22.0 // indirect 56 | google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect 57 | google.golang.org/grpc v1.68.1 // indirect 58 | google.golang.org/protobuf v1.36.5 // indirect 59 | gopkg.in/yaml.v3 v3.0.1 // indirect 60 | ) 61 | 62 | require ( 63 | github.com/cedana/cedana v0.9.241 64 | github.com/rs/zerolog v1.33.0 65 | github.com/spf13/cobra v1.9.1 66 | ) 67 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | buf.build/gen/go/cedana/cedana/protocolbuffers/go v1.36.5-20250226205333-5d0820253730.1 h1:525T4uQ3mOWJ/Tp20V2JjBkJQ0gZ6deWxBjOR35AcHk= 2 | buf.build/gen/go/cedana/cedana/protocolbuffers/go v1.36.5-20250226205333-5d0820253730.1/go.mod h1:TSJnz1qlHjIpVl9f2Rn09XGbIGkUXaRlAvv7F8HBEGg= 3 | buf.build/gen/go/cedana/criu/protocolbuffers/go v1.36.5-20250226205333-4b6f9efc37ef.1 h1:ob/WsItY2ugvDrWaP/jm8RhggM7jdSFFJdcJgMShZAU= 4 | buf.build/gen/go/cedana/criu/protocolbuffers/go v1.36.5-20250226205333-4b6f9efc37ef.1/go.mod h1:n+lNzmlKsCcoOgE9DxrmKvfiE3a4MF8fYoValjStFKE= 5 | github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= 6 | github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= 7 | github.com/cedana/cedana v0.9.241 h1:KG6vASM33aGAy1X5YRAjxT1IigahHmmC66ifqYL/lqw= 8 | github.com/cedana/cedana v0.9.241/go.mod h1:tlQh1RrqbPHKP23E0cUeM1M/DqyyvIOkfizciyJfHNE= 9 | github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= 10 | github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= 11 | github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= 12 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 13 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 14 | github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE= 15 | github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= 16 | github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= 17 | github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= 18 | github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= 19 | github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= 20 | github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= 21 | github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= 22 | github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c= 23 | github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4= 24 | github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= 25 | github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= 26 | github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= 27 | github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 28 | github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= 29 | github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 30 | github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= 31 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 32 | github.com/jedib0t/go-pretty v4.3.0+incompatible h1:CGs8AVhEKg/n9YbUenWmNStRW2PHJzaeDodcfvRAbIo= 33 | github.com/jedib0t/go-pretty v4.3.0+incompatible/go.mod h1:XemHduiw8R651AF9Pt4FwCTKeG3oo7hrHJAoznj9nag= 34 | github.com/jedib0t/go-pretty/v6 v6.6.5 h1:9PgMJOVBedpgYLI56jQRJYqngxYAAzfEUua+3NgSqAo= 35 | github.com/jedib0t/go-pretty/v6 v6.6.5/go.mod h1:Uq/HrbhuFty5WSVNfjpQQe47x16RwVGXIveNGEyGtHs= 36 | github.com/jedib0t/go-pretty/v6 v6.6.7 h1:m+LbHpm0aIAPLzLbMfn8dc3Ht8MW7lsSO4MPItz/Uuo= 37 | github.com/jedib0t/go-pretty/v6 v6.6.7/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU= 38 | github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= 39 | github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= 40 | github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= 41 | github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= 42 | github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 43 | github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= 44 | github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 45 | github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= 46 | github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= 47 | github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= 48 | github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= 49 | github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U= 50 | github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA= 51 | github.com/mdlayher/vsock v1.2.1 h1:pC1mTJTvjo1r9n9fbm7S1j04rCgCzhCOS5DY0zqHlnQ= 52 | github.com/mdlayher/vsock v1.2.1/go.mod h1:NRfCibel++DgeMD8z/hP+PPTjlNJsdPOmxcnENvE+SE= 53 | github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= 54 | github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= 55 | github.com/moby/sys/mountinfo v0.7.1 h1:/tTvQaSJRr2FshkhXiIpux6fQ2Zvc4j7tAhMTStAG2g= 56 | github.com/moby/sys/mountinfo v0.7.1/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= 57 | github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= 58 | github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= 59 | github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= 60 | github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= 61 | github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= 62 | github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= 63 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 64 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 65 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 66 | github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= 67 | github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= 68 | github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= 69 | github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= 70 | github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= 71 | github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= 72 | github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= 73 | github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= 74 | github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= 75 | github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= 76 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 77 | github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo= 78 | github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k= 79 | github.com/shirou/gopsutil/v4 v4.24.11 h1:WaU9xqGFKvFfsUv94SXcUPD7rCkU0vr/asVdQOBZNj8= 80 | github.com/shirou/gopsutil/v4 v4.24.11/go.mod h1:s4D/wg+ag4rG0WO7AiTj2BeYCRhym0vM7DHbZRxnIT8= 81 | github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= 82 | github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= 83 | github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs= 84 | github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4= 85 | github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y= 86 | github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= 87 | github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= 88 | github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= 89 | github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= 90 | github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 91 | github.com/spf13/viper v1.20.0 h1:zrxIyR3RQIOsarIrgL8+sAvALXul9jeEPa06Y0Ph6vY= 92 | github.com/spf13/viper v1.20.0/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= 93 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 94 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 95 | github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= 96 | github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= 97 | github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= 98 | github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= 99 | github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= 100 | github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= 101 | github.com/xeonx/timeago v1.0.0-rc5 h1:pwcQGpaH3eLfPtXeyPA4DmHWjoQt0Ea7/++FwpxqLxg= 102 | github.com/xeonx/timeago v1.0.0-rc5/go.mod h1:qDLrYEFynLO7y5Ho7w3GwgtYgpy5UfhcXIIQvMKVDkA= 103 | github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= 104 | github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= 105 | go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= 106 | go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= 107 | go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= 108 | go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= 109 | go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= 110 | go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= 111 | golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= 112 | golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= 113 | golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= 114 | golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 115 | golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= 116 | golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 117 | golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 118 | golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 119 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 120 | golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 121 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 122 | golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 123 | golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 124 | golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 125 | golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= 126 | golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 127 | golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= 128 | golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 129 | golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= 130 | golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 131 | golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= 132 | golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= 133 | golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= 134 | golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= 135 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 136 | google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 h1:ToEetK57OidYuqD4Q5w+vfEnPvPpuTwedCNVohYJfNk= 137 | google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 h1:TqExAhdPaB60Ux47Cn0oLV07rGnxZzIsaRhQaqS666A= 138 | google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= 139 | google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= 140 | google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= 141 | google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= 142 | google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= 143 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 144 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 145 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 146 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 147 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | // self_serve is functionally invisible unless we import it this way 4 | // because it's not imported anywhere else. 5 | import ( 6 | "context" 7 | 8 | "github.com/cedana/cedana-cli/cmd" 9 | ) 10 | 11 | // these get set by goreleaser 12 | var ( 13 | version = "dev" 14 | commit = "none" 15 | date = "unknown" 16 | ) 17 | 18 | func main() { 19 | cmd.SetVersionInfo(version, commit, date) 20 | cmd.Execute(context.Background(), version) 21 | } 22 | -------------------------------------------------------------------------------- /pkg/config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | "strconv" 8 | "strings" 9 | 10 | "github.com/cedana/cedana/pkg/utils" 11 | "github.com/spf13/viper" 12 | ) 13 | 14 | const ( 15 | DIR_NAME = ".cedana" 16 | FILE_NAME = "cli-config" 17 | FILE_TYPE = "json" 18 | DIR_PERM = 0o755 19 | FILE_PERM = 0o644 20 | ENV_PREFIX = "CEDANA_CLI" 21 | 22 | DEFAULT_SOCK_PERMS = 0o666 23 | 24 | DEFAULT_LOG_LEVEL = "info" 25 | ) 26 | 27 | // The default global config. This will get overwritten 28 | // by the config file or env vars during startup, if they exist. 29 | var Global Config = Config{ 30 | // NOTE: Don't specify default address here as it depends on default protocol. 31 | // Use above constants for default address for each protocol. 32 | Connection: Connection{ 33 | URL: "", 34 | AuthToken: "", 35 | }, 36 | } 37 | 38 | func init() { 39 | setDefaults() 40 | bindEnvVars() 41 | viper.Unmarshal(&Global) 42 | } 43 | 44 | type InitArgs struct { 45 | Config string 46 | ConfigDir string 47 | } 48 | 49 | func Init(args InitArgs) error { 50 | user, err := utils.GetUser() 51 | if err != nil { 52 | return err 53 | } 54 | 55 | var configDir string 56 | if args.ConfigDir == "" { 57 | homeDir := user.HomeDir 58 | configDir = filepath.Join(homeDir, DIR_NAME) 59 | } else { 60 | configDir = args.ConfigDir 61 | } 62 | 63 | viper.AddConfigPath(configDir) 64 | viper.SetConfigPermissions(FILE_PERM) 65 | viper.SetConfigType(FILE_TYPE) 66 | viper.SetConfigName(FILE_NAME) 67 | 68 | // Create config directory if it does not exist 69 | _, err = os.Stat(configDir) 70 | if os.IsNotExist(err) { 71 | err = os.MkdirAll(configDir, DIR_PERM) 72 | if err != nil { 73 | return err 74 | } 75 | } 76 | uid, _ := strconv.Atoi(user.Uid) 77 | gid, _ := strconv.Atoi(user.Gid) 78 | os.Chown(configDir, uid, gid) 79 | 80 | err = viper.ReadInConfig() 81 | if err != nil { 82 | if _, ok := err.(viper.ConfigFileNotFoundError); !ok { 83 | return fmt.Errorf("Config file %s is either outdated or invalid. Please delete or update it: %w", viper.ConfigFileUsed(), err) 84 | } 85 | } 86 | 87 | if args.Config != "" { 88 | reader := strings.NewReader(args.Config) 89 | err = viper.MergeConfig(reader) 90 | if err != nil { 91 | return fmt.Errorf("Provided config string is invalid: %w", err) 92 | } 93 | } else { 94 | err = viper.SafeWriteConfig() // Will only overwrite if file does not exist, ignore other errors 95 | if err != nil { 96 | if _, ok := err.(viper.ConfigFileAlreadyExistsError); !ok { 97 | return fmt.Errorf("Failed to write config file: %w", err) 98 | } 99 | } 100 | } 101 | 102 | err = viper.UnmarshalExact(&Global) 103 | if err != nil { 104 | return fmt.Errorf("Config file %s is either outdated or invalid. Please delete or update it: %w", viper.ConfigFileUsed(), err) 105 | } 106 | 107 | return nil 108 | } 109 | 110 | // Loads the global defaults into viper 111 | func setDefaults() { 112 | for _, field := range utils.ListLeaves(Config{}) { 113 | tag := utils.GetTag(Config{}, field, FILE_TYPE) 114 | defaultVal := utils.GetValue(Global, field) 115 | viper.SetDefault(tag, defaultVal) 116 | } 117 | viper.SetTypeByDefaultValue(true) 118 | } 119 | 120 | // Add bindings for env vars so env vars can be used as backup 121 | // when a value is not found in config. Goes through all the json keys 122 | // in the config type and binds an env var for it. The env var 123 | // is prefixed with the envVarPrefix, all uppercase. 124 | // 125 | // Example: The field `cli.wait_for_ready` will bind to env var `CEDANA_CLI_WAIT_FOR_READY`. 126 | func bindEnvVars() { 127 | for _, field := range utils.ListLeaves(Config{}) { 128 | tag := utils.GetTag(Config{}, field, FILE_TYPE) 129 | envVar := ENV_PREFIX + "_" + strings.ToUpper(strings.ReplaceAll(tag, ".", "_")) 130 | 131 | // get env aliases from struct tag 132 | aliasesStr := utils.GetTag(Config{}, field, "env_aliases") 133 | aliases := []string{tag, envVar} 134 | aliases = append(aliases, strings.Split(aliasesStr, ",")...) 135 | 136 | viper.MustBindEnv(aliases...) 137 | } 138 | 139 | viper.AutomaticEnv() 140 | } 141 | -------------------------------------------------------------------------------- /pkg/config/types.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | type ( 4 | // Cedana configuration. Each of the below fields can also be set 5 | // through an environment variable with the same name, prefixed, and in uppercase. E.g. 6 | // `Metrics.ASR` can be set with `CEDANA_METRICS_ASR`. The `env_aliases` tag below specifies 7 | // alternative (alias) environment variable names (comma-separated). 8 | Config struct { 9 | // LogLevel is the default log level used by the server 10 | LogLevel string `json:"log_level" key:"log_level" yaml:"log_level" mapstructure:"log_level"` 11 | // Connection settings 12 | Connection Connection `json:"connection" key:"connection" yaml:"connection" mapstructure:"connection"` 13 | } 14 | 15 | Connection struct { 16 | // URL is your unique Cedana endpoint URL 17 | URL string `json:"url" key:"url" yaml:"url" mapstructure:"url" env_aliases:"CEDANA_URL"` 18 | // AuthToken is your authentication token for the Cedana endpoint 19 | AuthToken string `json:"auth_token" key:"auth_token" yaml:"auth_token" mapstructure:"auth_token" env_aliases:"CEDANA_AUTH_TOKEN"` 20 | } 21 | ) 22 | -------------------------------------------------------------------------------- /pkg/flags/cmd.go: -------------------------------------------------------------------------------- 1 | package flags 2 | 3 | // This file contains all the flags used in the cmd package. 4 | 5 | type Flag struct { 6 | Full string 7 | Short string 8 | } 9 | 10 | var ( 11 | // Parent flags 12 | ConfigFlag = Flag{Full: "config"} 13 | ConfigDirFlag = Flag{Full: "config-dir"} 14 | 15 | ClusterFlag = Flag{Full: "cluster", Short: "c"} 16 | NamespaceFlag = Flag{Full: "namespace", Short: "n"} 17 | ) 18 | -------------------------------------------------------------------------------- /pkg/logging/logger.go: -------------------------------------------------------------------------------- 1 | package logging 2 | 3 | import ( 4 | "io" 5 | "os" 6 | "time" 7 | 8 | "github.com/cedana/cedana-cli/pkg/config" 9 | "github.com/rs/zerolog" 10 | "github.com/rs/zerolog/log" 11 | "github.com/rs/zerolog/pkgerrors" 12 | ) 13 | 14 | const ( 15 | LOG_TIME_FORMAT = time.TimeOnly 16 | LOG_CALLER_SKIP = 3 // stack frame depth 17 | ) 18 | 19 | type LineInfoHook struct{} 20 | 21 | func (h LineInfoHook) Run(e *zerolog.Event, l zerolog.Level, msg string) { 22 | if l >= zerolog.ErrorLevel { 23 | e.Caller(LOG_CALLER_SKIP) 24 | } 25 | } 26 | 27 | func init() { 28 | SetLevel(config.Global.LogLevel) 29 | } 30 | 31 | func SetLevel(level string) { 32 | var err error 33 | zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack 34 | 35 | logLevel, err := zerolog.ParseLevel(level) 36 | if err != nil || level == "" { // allow turning off logging 37 | logLevel = zerolog.Disabled 38 | } 39 | 40 | var output io.Writer = zerolog.ConsoleWriter{ 41 | Out: os.Stdout, 42 | TimeFormat: LOG_TIME_FORMAT, 43 | TimeLocation: time.Local, 44 | } 45 | 46 | log.Logger = zerolog.New(output). 47 | Level(logLevel). 48 | With(). 49 | Timestamp(). 50 | Logger().Hook(LineInfoHook{}) 51 | } 52 | -------------------------------------------------------------------------------- /pkg/style/cmd.go: -------------------------------------------------------------------------------- 1 | package style 2 | 3 | // All cmd styling related code should be placed in this file. 4 | 5 | import ( 6 | "github.com/jedib0t/go-pretty/v6/table" 7 | "github.com/jedib0t/go-pretty/v6/text" 8 | ) 9 | 10 | const MAX_LINE_LENGTH = 80 11 | 12 | var ( 13 | TickMark = "✔" 14 | BulletMark = "•" 15 | CrossMark = "✖" 16 | DashMark = "—" 17 | ) 18 | 19 | var ( 20 | TableStyle = table.Style{ 21 | Box: table.BoxStyle{ 22 | PaddingRight: " ", 23 | }, 24 | Format: table.FormatOptions{ 25 | Header: text.FormatUpper, 26 | }, 27 | Color: table.ColorOptions{ 28 | Header: text.Colors{text.Bold}, 29 | }, 30 | } 31 | PositiveColors = text.Colors{text.FgGreen} 32 | NegativeColors = text.Colors{text.FgRed} 33 | WarningColors = text.Colors{text.FgYellow} 34 | InfoColors = text.Colors{text.FgHiBlue} 35 | DisabledColors = text.Colors{text.FgHiBlack} 36 | 37 | HighLevelRuntimeColors = text.Colors{text.FgMagenta} 38 | LowLevelRuntimeColors = text.Colors{text.FgCyan} 39 | ) 40 | 41 | // BoolStr returns a string representation of a boolean value. 42 | func BoolStr(b bool, s ...string) string { 43 | if len(s) == 2 { 44 | if b { 45 | return PositiveColors.Sprint(s[0]) 46 | } 47 | return DisabledColors.Sprint(s[1]) 48 | } 49 | if b { 50 | return PositiveColors.Sprint("yes") 51 | } 52 | return DisabledColors.Sprint("no") 53 | } 54 | 55 | // Breaks a like if it's larger than certain length, by adding 56 | // a new line in between. Always breaks at a word boundary. 57 | func BreakLine(s string, length int) string { 58 | if len(s) > length { 59 | for i := length; i > 0; i-- { 60 | if s[i] == ' ' { 61 | return s[:i] + "\n" + BreakLine(s[i+1:], length) 62 | } 63 | } 64 | } 65 | return s 66 | } 67 | --------------------------------------------------------------------------------