#How to start a pod using command line runpodctl or python sdk
1 messages · Page 1 of 1 (latest)
It worked after a few minutes
Can anyone guide me as to how to start a pod using python sdk?
import runpod
runpod.api_key = "your_runpod_api_key_found_under_settings"
Get all my pods
pods = runpod.get_pods()
Get a specific pod
pod = runpod.get_pod(pod.id)
Create a pod
pod = runpod.create_pod("test", "runpod/stack", "NVIDIA GeForce RTX 3070")
Stop the pod
runpod.stop_pod(pod.id)
Resume the pod
runpod.resume_pod(pod.id)
Terminate the pod
runpod.terminate_pod(pod.id)
read more @desert cliff here
https://github.com/runpod/runpod-python?tab=readme-ov-file#gpu-cloud-pods
It does. But not on the first attempt.
hmm weird maybe its not in stopped
@summer lark Bro can you help me receive json file on the pod?
I am running a flask app on 5000
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/finetune', methods=['POST'])
def receive_finetune_request():
data = request.get_json()
bot_id = data.get('bot_id')
print(bot_id)
return jsonify({"message": "Received bot_id", "bot_id": bot_id}), 200
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000)
python app.py```
It starts the dev server how do send a post request to it with json using curl and postman?
I want to use the proxy.runpod.net later but current I am able to accomplish it with curl on localhost
```bash
curl -X 'POST' http://127.0.0.1:5000/finetune -H 'Content-Type: application/json' -d '{"bot_id": "112547"}'
{"bot_id":"112547","message":"Received bot_id"}
As well as on the flask screen
112547
127.0.0.1 - - [28/May/2024 12:28:25] "POST /finetune HTTP/1.1" 200 -
Hmm you need to expose the port first I forgot how, please check the docs
Then press connect on Runpod's website
You'll get the link
Thanks man. I forgot to expose the port. It worked now
I have yet to test the python sdk. Will let you know if that worked
Alr that's great
@summer lark The python sdk works. Thanks for that too.
No problem bro