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

tests/eas fixes #526

Merged
merged 6 commits into from
Dec 14, 2017
Merged

Conversation

valschneider
Copy link
Contributor

This PR brings some fixes to the expected_placement plotter in generic.py and also restores the old working directory for AndroidTarget as a temp fix to ARM-software/devlib#225

Copy link
Contributor

@mdigiorgio mdigiorgio left a comment

Choose a reason for hiding this comment

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

LGTM, just a small comment if you have time and will to do it

@@ -29,8 +29,6 @@
from unittest import SkipTest

import matplotlib.pyplot as plt
import numpy as np
import pylab as pl
import os
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you are at it you could do a general cleanup of the imports, which means having something like:

import one
import two
# etc.

from foo import bar
# etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done !

Copy link
Contributor

@derkling derkling left a comment

Choose a reason for hiding this comment

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

Some small changes... but overall LGTM ;-)

@@ -525,6 +525,7 @@ def _init_target(self, force = False):
self.target = devlib.AndroidTarget(
platform = platform,
connection_settings = self.__connection_settings,
working_directory = '/data/local/tmp/devlib-target',
Copy link
Contributor

Choose a reason for hiding this comment

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

While looking at this, I remembered we had already a 'workdir' configuration option, which is configurable via target.conf for example, which AFAIR was there exactly for that scope... however, perhaps due to some refactoring, it's now defined but never used 👎

You can see it's definition at line 224 above.

Can you please wire this up to this existing configuration option?

Mind that there is also a WORKING_DIR_DEFAULT, which I don't like so much.... we should probably instead have something like:

elif platform_type.lower() == 'android':
        # Workaround for ARM-software/devlib#225
        self.workdir = conf.get('workdir', '/data/local/tmp/devlib-target')
        self._log.debug('Setup ANDROID target...')
        self.target = devlib.AndroidTarget(...)
#...
else:
             raise ValueError('Config error: not supported [platform] type {}'\
                     .format(platform_type))

self.workdir = self.target.working_directory

where this last statement is just to ensure to always have the two variables aligned.

Copy link
Contributor

Choose a reason for hiding this comment

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

In the example above... of course in the Android case you pass in self.workdir as working_directory in the AndroidTarget ctor ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Devlib already defines default working directories for each of its target types - could I just drop the WORKING_DIR_DEFAULT thing ? That way I can just make self.workdir default to None and let devlib handle it.

@@ -322,7 +319,7 @@ def plot_expected_util(self, experiment, util_df):
prev = time

figname = os.path.join(experiment.out_dir, 'expected_placement.png')
pl.savefig(figname, bbox_inches='tight')
fig.savefig(figname, bbox_inches='tight')
Copy link
Contributor

Choose a reason for hiding this comment

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

This should better be on a different patch... either by itself, or eventually squased into "tests/eas/generic: Close exp_placement figure" which seems another fix... in this last case please update the commit message too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIR this change allows us to drop the pylab import, hence why it's in this commit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, in that case, since we already use pl.savefig all around in the analysis modules... perhaps removing the pylab module perhaps should be a self contained patch which does the same all around. Do you think that's possible? At least we keep consistency on how we save generated plots...

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, I'll keep that for another PR.

Valentin Schneider added 6 commits December 14, 2017 10:50
Removes a duplicate import and re-arranges the order of the imports.
It seems like closing unused figures isn't a default behaviour,
and we are getting some warning about that.
tests/eas/ was missing an __init__.py, which meant the backend set in
tests/__init__.py wouldn't be used.

This commit also removes the fill_between() call that is used to draw
the expected_placement figure, as it seems the desired behaviour is
not supported with the Agg backend ("Unknown property step").
Seems like the use of `self.workdir` got thrown away at some point.
This commit reconnects it to the devlib target constructor, and also
gets rid of the `WORKING_DIR_DEFAULT` definition since devlib already
defines default workdirs for its targets.
As mentionned in ARM-software/devlib#225,
using /sdcard causes some issues with the HiKey960. As we haven't
had any issues with using /data/local/tmp/ as a devlib working
directory, we now the use this directory by default.
@valschneider
Copy link
Contributor Author

valschneider commented Dec 14, 2017

  • Reinstored the use of pl.savefig in tests/generic.py
  • Reinstored the use of self.workdir in env.py and set the default for AndroidTarget to /data/local/tmp/devlib-target

Copy link
Contributor

@derkling derkling left a comment

Choose a reason for hiding this comment

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

One minor note... lemme know: if it does not make sense we can merge as it is ;-)

@@ -306,7 +306,6 @@ def plot_expected_util(self, experiment, util_df):
color = 'red'

tdf.plot(ax=ax[cpu], drawstyle='steps-post', title="CPU{}".format(cpu), color=color)
ax[cpu].fill_between(tdf.index, tdf, 0, step='post', color=color)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to test and use the method if the backend supports it?
I guess this allows to get better pretty locking plots when we run tests from out desktop....

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 had a quick look for that and it didn't seem very intuitive - that "step" parameter is part of the fill_between API so imho it should be supported by all of them. I have a post-it somewhere to remind me to look at that again sometime in the future...

Copy link
Contributor

Choose a reason for hiding this comment

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

What about just a simple try: except pass?

Copy link
Contributor Author

@valschneider valschneider Dec 14, 2017

Choose a reason for hiding this comment

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

Not too hot on that but we could do it.

I guess this allows to get better pretty locking plots when we run tests from out desktop....

For that you'll also have to change the backend defined in tests/__init__.py

Copy link
Contributor

Choose a reason for hiding this comment

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

As per chat we had, seems that fixing this is not enough to allow the removal of the Agg backend.
So, let's got with this version.

@derkling derkling merged commit 9c78978 into ARM-software:master Dec 14, 2017
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.

3 participants