hello! how can I access in a flow another flows’ m...
# ask-metaflow
g
hello! how can I access in a flow another flows’ metadata? let’s say I have a flow AFlow and BFlow, I need to have a step in BFlow which calls Flow(BFlow).latest_run.data object. I run flow in AWS sagemaker and save results in S3. It in BFlow returns Object not found error. Configuration file has METAFLOW_METASTORE_SYSROOT_S3 correctly specified
d
it may not be in the right namespace
to check run
namespace(None)
first to see.
g
namespace is the same, although I’ve tried to put namespace(None) in front of r = Run(AFlow/run_id) but getting the same error
d
could you paste the whole code (or the relevant section) and the full traceback.
g
Class Inference(FlowSpec): …… @step def load_last_model(self): “”" Loading last model from training flow “”" if self.is_prod: from metaflow import Run, namespace namespace(None) r = Run(self.run_id_actual_dict[‘IDCase’][‘training’]) self.model = r.data.lgbm_model self.last_model_file_name = r.data.model_file_name else: ……. Traceback:
Copy code
Task is starting.
Bootstrapping virtual environment...
Environment bootstrapped
<flow DPITForecastInferenceIDCase step load_last_model> failed:
AWS Batch error:
Essential container in task exited This could be a transient error. Use @retry to retry.
Object not found:
Run('DPITForecastTrainIDCase/1704964756701873') does not exist
here Run(self.run_id_actual_dict[‘IDCase’][‘training’]) is correctly specified, I’ve checked
d
ok, based on the ID, that run ran without a metadata service (it was a “local” run) so you won’t be able to reference them.
using the metaflow client (so using
Run
here) requires a metadata service that is accessible everywhere you are using the client. In your case, you seem to be using a
local
metadata service so what’s running on batch won’t have access to it.
g
it both flows I’m using the same configuration file and first flow was actually run on batch, as well as the second one. I can see metadata in S3 as well. You think this is still the case?
d
when you say you “see the metadata in S3”, what do you see in S3? S3 is used to store some things but there is also a metadata service. S3 is used during execution but the service is used for the client.
g
i mean I see directory that metaflow has created
Can you please advise how should I run the flows, configure the env so I can access one flows metadata from another flow?
Dear @dry-beach-38304 , can you please advise ? thank you inadvance!
d
hey sorry — went to bed
how did you install metaflow and in particular did you install a metadata service as described here: https://outerbounds.com/engineering/service-architecture/#metadata.
you can check what you are using as a metadata by doingthe following:
Copy code
from metaflow import get_metadata
get_metadata()
If it prints something like
service@<some url>
then you are good but I suspect it will print something like
local
. If that is the case, your Metaflow is wrongly configured for the use case you want for it (ie: cross reference) and if you let me know how you installed it, I may be able to help or will ask some helpful person from OB (they have more experience with setup like that).
g
yes, you’re right. I have installed metaflow with simple pip install and didn’t configure metaflow service. Let me check the article and rebuild everything. Thank you so much for your hint!
Dear @dry-beach-38304, it didn’t fixed and I’ve formulated a new question on how to configure ens such that get_metadata is not local. Can you please have a look? https://outerbounds-community.slack.com/archives/C02116BBNTU/p1705498802785069