Hemabh Kamboj
02/28/2024, 5:26 PMMarvin
02/28/2024, 5:26 PMpython
from prefect import flow, task
@task(task_run_name="Adding {x} and {y}")
def add(x: int, y: int) -> int:
    return x + y
@flow
def my_flow(x: int, y: int):
    first_result = add(x, y) 
    second_result = add(first_result, first_result)
    return add(first_result, second_result)
if __name__ == "__main__":
    my_flow(1, 2)  # Here, you would replace (1, 2) with your argument values.Hemabh Kamboj
02/28/2024, 5:27 PMMarvin
02/28/2024, 5:28 PMprefect deployment applyHemabh Kamboj
02/28/2024, 5:43 PMMarvin
02/28/2024, 5:44 PMmy-docker-poolnohupscreenbash
     nohup prefect agent start --pool my-pool &screentmuxbash
     screen -dmS agent prefect agent start --pool my-poolprefect agent start --pool my-poolmy-poolHemabh Kamboj
02/29/2024, 5:34 PMMarvin
02/29/2024, 5:36 PMAuthorizationpython
import requests
url = '<https://api.prefect.io/graphql>'
headers = {
    'Authorization': 'Bearer YOUR_PREFECT_API_KEY',
    'Content-Type': 'application/json'
}
payload = {
    'query': '''
        mutation($input: createFlowRunInput!) {
            createFlowRun(input: $input) {
                id
            }
        }
    ''',
    'variables': {
        'input': {
            'flowId': 'YOUR_FLOW_ID',
            'parameters': {
                'param1': 'value1',
                'param2': 'value2'
            }
        }
    }
}
response = <http://requests.post|requests.post>(url, json=payload, headers=headers)
print(response.json())YOUR_PREFECT_API_KEYYOUR_FLOW_IDparam1param2value1value2Hemabh Kamboj
02/29/2024, 6:39 PMMarvin
02/29/2024, 6:40 PMAuthorization