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

feat(marxan-run): zip input & output directories #316

Merged
merged 9 commits into from
Jul 9, 2021

Conversation

kgajowy
Copy link
Contributor

@kgajowy kgajowy commented Jul 7, 2021

Substitute this line for a meaningful title for your changes

Overview

Please write a description. If the PR is hard to understand, provide a quick explanation of the code.

Designs

Link to the related design prototypes (if applicable)

Testing instructions

Please explain how to test the PR: ID of a dataset, steps to reach the feature, etc.

Feature relevant tickets

Link to the related task manager tickets


Checklist before submitting

  • Meaningful commits and code rebased on develop.
  • If this PR adds feature that should be tested for regressions when
    deploying to staging/production, please add brief testing instructions
    to the deploy checklist (docs/deployment-checklist.md)
  • Update CHANGELOG file

@vercel
Copy link

vercel bot commented Jul 7, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

marxan – ./app

🔍 Inspect: https://vercel.com/vizzuality1/marxan/9p2TuvHZcVAa7RR1YTkSvD3RTMqd
✅ Preview: https://marxan-git-feat-marxan-498-persist-metadata-87fbcc-vizzuality1.vercel.app

marxan-storybook – ./app

🔍 Inspect: https://vercel.com/vizzuality1/marxan-storybook/JBnG1YsJcYvVwVuXRNAvtKijzmwV
✅ Preview: https://marxan-storybook-git-feat-marxan-498-persist-4a8723-vizzuality1.vercel.app

@kgajowy kgajowy marked this pull request as ready for review July 7, 2021 08:23
@kgajowy kgajowy requested review from hotzevzl and Dyostiq July 7, 2021 08:23

get(
type: 'INPUTDIR' | 'OUTPUTDIR',
within: Workspace,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think Workspace is not entirely required here, maybe consider passing just the workingDirectory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It could but the intention was to provide this via Workspace to ensure it is what it is supposed to be instead raw string.

Not strongly convinced to either option tho. Do you see any strong benefits by passing only path?
@Dyostiq

Copy link
Contributor

Choose a reason for hiding this comment

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

From my point of view, it violates the principle of least knowledge a bit and makes the code harder to test as you need to pass the entire workspace instead of only the part. Then, the big object propagates through the stack just only to pass the path. If you think that passing a raw string is not as expressive as you'd like it to be, maybe wrapping it in an object is a solution – but still, you can pass only really needed data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +45 to +48
await this.metadataRepository.save(scenarioId, workspace, {
stdOutput,
stdErr,
});
Copy link
Contributor

@Dyostiq Dyostiq Jul 7, 2021

Choose a reason for hiding this comment

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

according to my previous comment, the workspace path could be passed here instead of the entire workspace

Comment on lines +16 to +20
@Column({ name: `std_out`, nullable: true, type: 'character varying' })
stdOutput?: string | null;

@Column({ name: `std_err`, nullable: true, type: 'character varying' })
stdError?: string | null;
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we could keep the same names in columns, so std_ouput and std_error

const config = this.reader.read(
joinPath(within.workingDirectory, 'input.dat'),
);
const matcher = new RegExp(`(${type} )(?<dir>.*)$`, 'gm');
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 the regex start with ^?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Dyostiq it could but doesn't matter there (multiline & known format)

Copy link
Contributor

Choose a reason for hiding this comment

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

matters, as the file may contain comments, so:

a comment like this suggesting using INPUTDIR something

matches the regex

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha, you are right!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

2 participants