Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongo action store #8147

Merged
merged 29 commits into from
Oct 23, 2023
Merged

mongo action store #8147

merged 29 commits into from
Oct 23, 2023

Conversation

koenvanderveen
Copy link
Collaborator

No description provided.

`MongoActionStore` now is a `KeyValueActionStore`, which has a backing store as `MongoBackingStore`

Implemented basic functionalities such as connecting to mongo client, `_set`, `_exists`

Co-authored-by: Shubham Gupta <[email protected]>
@khoaguin khoaguin self-assigned this Oct 11, 2023
@khoaguin
Copy link
Member

Test:

  1. Launch a docker node with hagrid launch to docker:8081 --dev --tail
  2. Login to the node and upload a dataset
import syft as sy
import pandas as pd
from syft import autocache
domain_client = sy.login(url='http://localhost:8081', email="[email protected]", password="changethis")

country = sy.DataSubject(name="Country", aliases=["country_code"])

canada = sy.DataSubject(name="Canada", aliases=["country_code:ca"])
germany = sy.DataSubject(name="Germany", aliases=["country_code:de"])
country.add_member(canada)
country.add_member(germany)
response = domain_client.data_subject_registry.add_data_subject(country)
data_subjects = domain_client.data_subject_registry.get_all()

canada_dataset_url = "https://github.com/OpenMined/datasets/blob/main/trade_flow/ca%20-%20feb%202021.csv?raw=True"
df = pd.read_csv(autocache(canada_dataset_url))
# private data samples
ca_data = df[0:10]
ca_data
# Mock data samples
mock_ca_data = df[10:20]
mock_ca_data

dataset = sy.Dataset(name="Canada Trade Value")
dataset.set_description("Canada Trade Data")
dataset.add_citation("Person, place or thing")
dataset.add_url("https://github.com/OpenMined/datasets/tree/main/trade_flow")

dataset.add_contributor(name="Andrew Trask", 
                        email="[email protected]",
                        note="Andrew runs this domain and prepared the dataset metadata.")

dataset.add_contributor(name="Madhava Jay", 
                        email="[email protected]",
                        note="Madhava tweaked the description to add the URL because Andrew forgot.")

ctf = sy.Asset(name="canada_trade_flow")
ctf.set_description("Canada trade flow represents export & import of different commodities to other countries")
ctf.add_contributor(name="Andrew Trask", 
                    email="[email protected]",
                    note="Andrew runs this domain and prepared the asset.")
ctf.set_obj(ca_data)
ctf.set_shape(ca_data.shape)
ctf.add_data_subject(canada)
ctf.no_mock()
dataset.add_asset(ctf)
ctf.set_mock(mock_ca_data, mock_is_real=False)

domain_client.upload_dataset(dataset)
  1. Connect to the Mongo server and observe that we have Action_data and Action_permissions collections
    image

image

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Member

@shubham3121 shubham3121 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work @khoaguin !!! 🎉 🔥

@shubham3121 shubham3121 enabled auto-merge October 23, 2023 05:17
@shubham3121 shubham3121 disabled auto-merge October 23, 2023 09:49
@shubham3121 shubham3121 merged commit cd9e5ef into dev Oct 23, 2023
26 of 27 checks passed
@shubham3121 shubham3121 deleted the mongo-action-store2 branch October 23, 2023 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants