Skip to content

DM-7829: adapt LC viewer to use IRSA api #250

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

Merged
merged 3 commits into from
Dec 9, 2016
Merged

Conversation

ejoliet
Copy link
Contributor

@ejoliet ejoliet commented Dec 8, 2016

This PR is about hooking up the IRSA API and adapt the UI form to get the information and compute the periodogram. I have included also 2 more properties in app.config that control the exposed API parameters and the url.

I've also changed couple of classes to be able to control the level of the log4j and logging when running unit test. Unit test that extends from a ConfigTest class will load properties to set log levels and app configuration properties in runtime.

See more detail in the ticket for the API reference.

In order to test: bring the LC app and load a raw table. Then go to periodogram tab and play around. Every change should give different periodogram profile.


# Tests level of output - change to INFO/WARNING to have more logs for example.
# This set the level to SEVERE to all the classes using java.util.logging logger when running tests
java.util.logging.ConsoleHandler.level=SEVERE
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there libraries using java logging within our test environment? If so, is there a way to configure it to use Log4J instead? I am afraid using both would be confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unfortunately third party libraries use logging instead so you need to add the level property to cover this logger.

irsa.gator.service.periodogram.url = "http://bacchus.ipac.caltech.edu:9027/cgi-bin/periodogram/nph-periodogram_api"

// Periodogram API request parameter list definition, separated by space
irsa.gator.service.periodogram.keys = "x y alg step_method pmin pmax step_size peaks"
Copy link
Contributor

Choose a reason for hiding this comment

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

app.config are meant for properties that changes depending on the environment it's deployed to.
This does not look like one that will. For class level properties, we have a 'resources' directory in the same source package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, imagine that the dev/test API has different keys than OPS, i still want to control that.

<div>
<div>
<div style={{height:'100%'}}>
<div style={{height:'100%'}}>
Copy link
Contributor

Choose a reason for hiding this comment

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

if you don't mind, will you remove the outer div? it's pointless to have it since it does not serve anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok.

}
}
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

This variable is hard to read. It's in json format when it does not need to and seem to be deeper than necessary.
Why not?

const plotConfig = {
        periodogram: {x: 'Period', y: 'Power'},
        peaks: {x: 'Power', y: 'Peak'}
    }

const {periodogram, peaks} = plotConfig;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is funny, for me is rather easier to read the other way but is probably less lines to read so yes i can clean it up.

<br/>
<span> <b>Period Step Method: </b></span>
<br/> <br/>
<ListBoxInputField initialState={{
Copy link
Contributor

Choose a reason for hiding this comment

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

The style and layout of this panel need more work. In general, it's a bad idea to use
for layout because it's dependent on font-size. Also, the duplicate labeling used for grouping only add to the cluttering.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, and we will need a cleanup story once we decide the layout and form.

'step_method': fields.stepMethod.value,
'step_size': fields.stepSize.value,
'peaks': fields.peaks.value,
//'result_table': 'http://web.ipac.caltech.edu/staff/ejoliet/demo/vo-nexsci-result-sample.xml', //For now return result table for non-existing API
Copy link
Contributor

Choose a reason for hiding this comment

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

I find it easier to read if the prop name is not quoted. Anything in quotes will be highlighted as string when they are not.

//let catname0 = get(FieldGroupUtils.getGroupFields(gkey), 'cattable.value', catTable[0].value);
const fields = FieldGroupUtils.getGroupFields(gkey);
const srcFile = tbl.request.source;
console.log(fields);
Copy link
Contributor

Choose a reason for hiding this comment

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

console.log should be removed. there's more in other part of this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok.


public static void load(String propFile) throws IOException {
// If there are no file properties, no need to add anything
Properties props = System.getProperties();
Copy link
Contributor

Choose a reason for hiding this comment

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

Typically, you want to merge system's properties at the end so you can override it via command line.

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 thought that's what AppProperties.loadClassPropertiesFromFileToPdb was doing... isn't it?

e.printStackTrace();
}
return null;
return "http://web.ipac.caltech.edu/staff/ejoliet/demo/AllWISE-MEP-m82-2targets-10arsecs.tbl";
Copy link
Contributor

Choose a reason for hiding this comment

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

I strongly suggest test data be moved to firefly_test_data git repos. There is no way to guaranteed the integrity of the test when the data is not controlled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right but here is more an integration test than a unit test, you need to test it from reading a URL and not a local file. See:edu.caltech.ipac.firefly.server.query.lc.IrsaLightCurveHandler#isPost

In order to test local file upload, you can check out the other test:
edu.caltech.ipac.firefly.util.PostDownloadTest

Copy link
Contributor

@loitly loitly Dec 8, 2016

Choose a reason for hiding this comment

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

I guess you misunderstood. "http://web.ipac.caltech.edu/staff/ejoliet/demo/AllWISE-MEP-m82-2targets-10arsecs.tbl" is used as an input file to testPhaseFoldedCurve @test.
Instead of getting the file from an external source, it should be in our firefly_test_data repository.

@loitly
Copy link
Contributor

loitly commented Dec 8, 2016

Mostly minor things, but they should be fixed.
I get this when I run test.
AppProperties: Could not find file: ./config/app-test.prop
More tooltips are needed. If you have them, you should include them into the fields.

@ejoliet
Copy link
Contributor Author

ejoliet commented Dec 8, 2016

that's because i forgot to add the file `src/firefly/config/app-test.prop' ;-). There should a default one. Sorry about that. Will add it to the commit together with the rest of the changes.

@ejoliet ejoliet merged commit d384654 into dev Dec 9, 2016
@ejoliet ejoliet deleted the DM-7829-use-irsa-lc-api branch December 9, 2016 01:30
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