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

fix(datasets): if a dataset fails we display non-failed datasets #933

Merged
merged 1 commit into from
May 19, 2020

Conversation

vfried
Copy link
Contributor

@vfried vfried commented May 15, 2020

Closes #924

In case a dataset fetch fails all dataset fetch was failing.

This was causing a "no dataset inside this project" message.

Now in case a dataset can't be fetched we display all the datasets that where fetched with no problem.

I also replaced some calls to get dataset for simplified ones when we don't need to get all the dataset info (i.e redirect after dataset add).

@vfried vfried requested a review from a team as a code owner May 15, 2020 13:50
@vfried
Copy link
Contributor Author

vfried commented May 18, 2020

To make a dataset fail you can do this...

Inside /api-client/project.js you choose a dataset that you want to make fail and change "NAME-OF-DATASET-THAT-WILL-FAIL" for the name of the dataset that will fail

 client.getProjectDatasetsFromKG = (projectPath) => {
    let url = `${client.baseUrl}/knowledge-graph/projects/${projectPath}/datasets`;
    url = url.replace("/api", "");//The url should change in the backend so we don't have to do this
    const headers = client.getBasicHeaders();
    return client.clientFetch(url, { method: "GET", headers }).then((resp) => {
      return resp.data;
    }).then(resp => {
      let fullDatasets = resp.map(dataset => {
        if (dataset.name === "NAME-OF-DATASET-THAT-WILL-FAIL")
          return client.fetchDatasetFromKG(dataset._links[0].href + "123");
        return client.fetchDatasetFromKG(dataset._links[0].href);
      });
      return Promise.all(fullDatasets);
    });
  };

Copy link
Contributor

@ciyer ciyer left a comment

Choose a reason for hiding this comment

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

Code looks good. I just have a question about the change because it silently drops datasets that return an error when we try to retrieve the full information. Do you think this is the right behavior, or should we show the information we have for those datasets with a message the the full dataset could not be retrieved?

@@ -54,7 +54,7 @@ function ImportDataset(props) {

const findDatasetInKgAnRedirect = (oldDatasetsList) => {
let waitForDatasetInKG = setInterval(() => {
props.client.getProjectDatasetsFromKG(props.projectPathWithNamespace)
props.client.getProjectDatasetsFromKG_short(props.projectPathWithNamespace)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain why you switched from getProjectDatasetsFromKG to getProjectDatasetsFromKG_short here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The get projects from KG fetches the datasets list and also the details of the dataset (this means one call per dataset plus one call to get the datasets list). The dataset import fetches de dataset list to see if there was a dataset added and if there is it redirects the user. We don't need all the dataset details that the getProjectDatasetFromKG gives. Maybe i whould rename the functions to "getProjectDatasetsFromKgEnriched" and "getProjectDatasetFromKG"

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 I like the name getProjectDatasetsFromKgEnriched

return Promise.all(fullDatasets);
return Promise.all(fullDatasets).then(datasets => {
//in case one of the dataset fetch fails we return the ones that didn't fail
return datasets.filter(dataset => dataset !== "error");
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to put in a placeholder for the dataset that failed, showing the information we have and a message that the dataset could not be retrieved?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made a comment about this bellow... i think that we shouldn't overthink this because it will change soon since kuba will return datasets enriched from the KG.

@vfried
Copy link
Contributor Author

vfried commented May 19, 2020

What happens here is that i get from the KG a list of datasets that has an error, then i try to fetch details from this list and this is when the error makes things fail. This should not happen... i shouldn't be getting from the backend a list that has an error. This is why i decided to drop the error instead of displaying something. (What is causing this error to happen is that there are two datasets with the same ID if i understand correctly, this is why i say this error shouldn't happen).

After kuba finishes this SwissDataScienceCenter/renku-graph#298 we will stop fetching dataset per dataset and will have to change this anyways... hopefully this should be solved also so i wouldn't put to many effort on fixing something that will change soon.

Copy link
Contributor

@ciyer ciyer left a comment

Choose a reason for hiding this comment

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

👍

@vfried vfried merged commit 506f5f2 into master May 19, 2020
@ciyer ciyer deleted the 924-dataset-fetch-fails branch June 29, 2020 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When one dataset fetch fails dataset's aren't displayed
2 participants