New RunLLM response generated: >>>*# Question* I ...
# runllm-flyte-trial
j
New RunLLM response generated: >>>*# Question* I have 2 endpoints : ep1, ep2 ep1 has two projects e1p1, e1p2 ep2 has two projects e2p1, e2p2 i have to fetch a task(t4 of n1) from a launch plan in ep1 it is as follows start->n0(t0->t1) ==> n1(t0->t1->t2->t3->t4->t5)->end in the above launch plan n0, n1 are the subworkflows what i need to do is to fetch the inputs of a previous execution of the above launchplan for task n1t3 and fetch the task t4 itself from ep1 now use the task fetched above and inputs for a previous particular execution and execute it on endpoint ep2
Copy code
remote1 = FlyteRemote(
        Config.for_endpoint("<http://flyte.us.cloud.ep1.com|flyte.us.cloud.ep1.com>"),
        default_domain=domain,
    )

remote2 = FlyteRemote(
        Config.for_endpoint("<http://flyte.us.cloud.ep2.com|flyte.us.cloud.ep2.com>"),
        default_domain=domain,
    )

executionId = 'excID'
# to fetch inputs
inputs = remote1.get(f"<flyte://v1/xxxxxxxx/development/{executionId}/n1-0-n4/i>")
resolved_inputs = inputs.literals

# to fetch the task
task = remote1.fetch_task(project=e1p1,
                             domain=domain,
                             name="xxx",
                             version=version)

execution = remote2.execute(
        task,
        inputs=resolved_inputs,
        # type_hints=type_hints,
        wait=True
    )
this is big picture of what i want to do But in this way when i try to get the inputs using remote.get() the inputs are in the following format
>>```inputs = {
'doc_records': [[ {'chunking_strategy': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/19b51b99bbb056e66111c600f130cb12/658946114c44a5f359a6cff4403da9df', 'section_name': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/ffc62cdcf77a0aba9034ac7e18bcaa1f/5f5eeac0b52bdcf77051f3b99c6d1a0c', 'chunk_limit': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/6c4b70e927a76414e7a8b546148a4e57/06ebc0904e06ba10f259820a25e44223', 'chunked_curated_text': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/d4a75921505aef366460e687b1183da2/cb5fce120a28297eccda5911c7794c08', 'chunk_type': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/d7b1cf55a08fbab1822ba2339e3500d3/cac0b82c45dc01001ddd2c4e6c748df1', 'document_id': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/f4dd76fdce0b3505cb45f008df44f759/918014083a0264dbee763ebfa76458db', 'chunk_context': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/d61ee65273443d1cc45382ce3913b48e/f059ea4dd46a16928eeecb28a376fee4', 'curated_text': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/4f4e274e0c660a2472660a7b338280f2/8c9281071b99e948f5feafe861a7d9eb', 'document_type': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/cb7c8671b56ec5c61c925149f5aca84f/bfce25c3b4f76f53d149dd4cd63c7aeb', 'document_name': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/c69640c03fc5a1f94ac9448e0b623c3f/f0fc5b171b942484f9b472924621b6f2', 'document_version': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/6357a7015b3ea42f35c92f23282e74c6/5f27a1965500114a93463d88588d0a0d', 'curated_entity_text': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/3e4f6eff6c1889adfab8c01e90da09bf/e90ba3ffc39e1edd0238292d72621967', 'chunk_order': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/650370c86650e0f7763f845059a56da4/9e06af055e3ba7ef2991bb605e2d6980'}, ```
>>``` {'chunking_strategy': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/8e7e7753433250ddefa1a9a01c606338/4a40433e2bc6fcd99bd3f4615498a336', 'curated_entity_text': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/ea0003a7e9f1e936fd9d54c08a633983/599661f8776fe2b3d53681c551b4e8a9', 'chunk_limit': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/5ead26d0bf3ec10979414ee447b13569/00db5e7f4bc2fd2db8a6cb253952b5ac', 'chunked_curated_text': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/3fe89932a24b7c78ea77bd081fbbf2db/4067b628fdaf2bfd0e423a0542da6f2f', 'chunk_type': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/90a6739d03995ad6504fdb60d04ea0bd/4742a19148418eb42e898d5221a4e97c', 'document_id': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/761b4eb9aebef3a95ecab266b9fba136/0381ce00ee5eff071b37a484704d318f', 'curated_text': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/ab6cfe9b938e31c15842438ed07fa632/18a2dbfe35c6236f874a1a7abe8247ab', 'chunk_context': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/f8369008b80877de94f9b84a1eccca08/154590a9c0dc64762e20af7a50b369da', 'document_type': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/b5a0ed52a8e2ce4b133607edc7083e22/5cc1b959923d4559b4075ae81f835162', 'document_name': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/0abddd7926c86519a04109b822ee8885/7d6facfa0ee2f6cea1d4abb366100118', 'document_version': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/68ff9dc4275f815def3daa8589c0ced6/16978ba3059b58c35714880c53140881', 'section_name': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/b2bf4d66911edbe5a113c39e5ba806c9/828c65a501ecf700e8837d458730f111', 'chunk_order': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/b6c1e2affcf75be658e1e724c0852274/f02859a80635d1e41b9e4be3f85dcf1b'},
```
>>``` {'chunking_strategy': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/c2142fbfd135d0226b8e2ed266d8867f/62aa6de6e040becd0cb62b6f1150aaf9', 'section_name': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/57d02369ef7fcfc114919443ee032dfd/e98c843bf0a1d084d74d4d6284b53139', 'chunk_limit': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/3c0a1acf3d41d99911f028174d30fbd6/0c3cc73c808faffa48a97c3f4cdbc774', 'chunked_curated_text': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/8c3bc8dc13ef6f275ec04ec18cbea92d/5fecb3905ab824e6bac53bbb685737d5', 'chunk_type': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/8a68a30f4c8ef7b4849e703c0ba0a16d/9057e6d1e08d5f6f8d99771532e8ad6d', 'document_id': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/ffdb6967e7d8fe42675994c35effe0af/2b008f1910badda14c220622bc9fbb5f', 'curated_text': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/384d75147246bedae73eee92291b38a4/1861b5379fc5b36d50d7913a9a614822', 'chunk_context': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/0a41e77e37717b7228c7d404a77c15ac/4604eeea7f1972347d4f38722650b7be', 'document_type': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/a56bf81c97fb0d0837e6219d13c9a143/edbe76a7f1deca0429225dcf971037c0', 'document_name': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/64fc5b92d3460cf64a4408bb92162e49/75be3e2f853f095707a12b3a0d052972', 'document_version': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/8ba0f0c5b88ea648512671b694813b6b/37163018723d72058bcfcbff864ac1a8', 'curated_entity_text': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/170785ee6c602ce2414d06d57c4f2638/31e5c771bdb628341a2d010f695953f5', 'chunk_order': 's3://uniphore-flyte-prod-us/o2/autoexecution7254-n1-0-n3-0-n0-0/16c99be0e58434b42d425e6c2281242a/ad8c76bd7774b7d0a5ded29461aed810'},
....```
>>
With this way i'm facing issue with send the inputs # Answer To achieve your goal of fetching inputs from a previous execution and executing a task on a different endpoint, you need to handle the serialization and deserialization of inputs correctly. The inputs you fetched are in a serialized format (likely S3 URIs), and you need to deserialize them into a format that can be used for execution. 1. Fetch Inputs: Use
FlyteRemote
to fetch the inputs from the previous execution. The inputs are likely serialized and stored in S3, as indicated by the URIs. 2. Deserialize Inputs: You need to deserialize these inputs from their serialized format (e.g., JSON, protobuf) into Python objects. This might involve downloading the data from S3 and using a deserialization library. 3. Fetch Task: Use
FlyteRemote.fetch_task
to retrieve the task definition from the first endpoint. 4. Execute Task: Use
FlyteRemote.execute
on the second endpoint with the deserialized inputs. Here's a basic outline of how you might handle the deserialization:
Copy code
import json
import boto3

# Assuming inputs are stored as JSON in S3
s3_client = boto3.client('s3')

def fetch_and_deserialize_input(s3_uri):
    bucket, key = parse_s3_uri(s3_uri)
    response = s3_client.get_object(Bucket=bucket, Key=key)
    data = response['Body'].read()
    return json.loads(data)

def parse_s3_uri(s3_uri):
    # Parse the S3 URI to get bucket and key
    path = s3_uri.replace("s3://", "")
    bucket, key = path.split("/", 1)
    return bucket, key

# Fetch and deserialize inputs
inputs = fetch_and_deserialize_input('<s3_uri_here>')
Would you like more details on any specific part of this process? Sources: - FlyteRemote API Documentation Slack Link https://.slack.com/archives/CP2HDHKE1/p1731945822.825849 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.