Skip to content

Conversation

@umesh-timalsina
Copy link
Contributor

@umesh-timalsina umesh-timalsina commented Apr 9, 2020

To Dos:

  • Stat Method for a file for S3 Storage Backend.
  • Stat Method for a file in SciServer-Files.
  • Tests

…tension

1. Add stat method in sciserver-files
2. Complete plugin for transfering arbitrary paths
3. Write tests for stat method in StorageFeatures.spec.js
@umesh-timalsina umesh-timalsina marked this pull request as ready for review April 10, 2020 16:33
icon: 'swap_vert',
action: DeepForge.create.Artifact
action: function() {
DeepForge.create.Artifact('dataPath');
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not a fan of this method signature as I find it a bit unnatural. It's odd that the string passed corresponds to a key in the config to omit. My initial reaction was that the string passed was specifying the way in which the artifact was being referenced.

I think it would probably be more natural to just filter the configStructure (or entire metadata) here and then pass that as the input to the argument.

@brollb brollb added this to the v2.3.0 milestone Apr 13, 2020
Copy link
Contributor

@brollb brollb left a comment

Choose a reason for hiding this comment

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

It might be nice to add some unit tests, too, though it isn't clear how easy that would be given the lack of a storage adapter that supports stat without requiring us spinning up something like minio. That said, it isn't blocking this PR.

], function(
) {
const Artifacts = function () {
throw new Error('Aritifacts is supposed to be used as an extension object, do not instantiate');
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: Aritifacts -> Artifacts

return base;
};

Artifacts.prototype.createArtifact = async function (baseNode, attrs) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this accept baseNode as an input? Isn't this always Data from the metamodel?

}

S3Storage.prototype.stat = async function (path) {
const metadata = await this._stat(path, this.bucketName);
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be nice to remove _stat as it is only used in stat to simplify the code a little bit (the method name isn't terribly informative). Not a huge deal though


Artifacts.prototype.constructor = Artifacts;

Artifacts.prototype.getBaseNode = function (baseName) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think adding a parameter (which is always "Data") is the right solution here. This could be renamed to something like getArtifactMetaNode though I think a better solution would be to change the method to perform the entire check that is duplicated in both plugins. Something like ensureCompatibleMeta which is an async method that throws the an error with the message returned in the callback. Then each plugin could run that first in their main function.

Copy link
Contributor

Choose a reason for hiding this comment

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

This could mean that we are just adding a new method btw. This method doesn't need to be removed as it could still be used by the other methods in this file. That said, it should still probably be renamed :)

const runArtifactPlugin = async function(pluginName) {
const pluginMetadata = copy(WebGMEGlobal.allPluginsMetadata[pluginName]);
const backends = pluginName === UPLOAD_PLUGIN ? storageBackends :
storageBackends.filter(backend => backend !== 's3');
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be removing the "gme" backend?

umesh-timalsina and others added 2 commits April 15, 2020 18:40
1. Fix stat method in s3Storage to use a single function
2. Change 's3' from filter to 'gme' in globals.js
3. Add 'ensureCompatibleMeta' in Artifacts.js
4. Fix typo in ImportArtifact
5. Refactor getBaseNode to getArtifactMetaNode in Artifacts.js
@brollb
Copy link
Contributor

brollb commented Apr 16, 2020

After playing with it a bit, I think there is a better way to display the config info. It seemed a little unclear what the path was referring to when it was part of its own section and seemed more fitting to simply be an additional field for every storage backend. I updated the config dialog accordingly:

DeepinScreenshot_select-area_20200416091801
DeepinScreenshot_select-area_20200416091753

@brollb
Copy link
Contributor

brollb commented Apr 16, 2020

The order for the uploading plugin still makes sense as there is no connection between the uploaded artifact and the storage backend.

@brollb brollb merged commit 35e872a into master Apr 16, 2020
@brollb brollb deleted the 1608-import-artifact-extension branch April 16, 2020 15:11
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.

2 participants