Comments (4)
OK, this should be fixed as of the latest commit - can you check?
from qmt.
Can't test the specific issue due to things not working generally.
Using the first section of an example sent by Spencer last week:
from qmt.tasks import Task, SweepManager
class HelloWorldTask(Task):
def __init__(self):
super().__init__()
def _solve_instance(self, inputs, options):
print("Hello World")
hi = HelloWorldTask()
em = SweepManager.create_empty_sweep()
print(hi.run_daskless())
If I try to run it as-is:
$ python3 foo.py
Traceback (most recent call last):
File "foo.py", line 15, in <module>
print(hi.run_daskless())
File "/home/donjan/ETH/PhD/code/qmt/qmt/tasks/task.py", line 298, in run_daskless
self.daskless_result = self.__class__._solve_instance(input_result_list, self.options)
TypeError: _solve_instance() missing 1 required positional argument: 'options'
Removing the self,
part from _solve_instance
yields:
$ python3 foo.py
Hello World
None
Now using dask:
from qmt.tasks import Task, SweepManager
class HelloWorldTask(Task):
def __init__(self):
super().__init__()
def _solve_instance(inputs, options):
print("Hello World")
hi = HelloWorldTask()
em = SweepManager.create_empty_sweep()
print(em.run(hi))
Gives:
$ python3 foo.py
Traceback (most recent call last):
File "foo.py", line 14, in <module>
print(em.run(hi))
File "/home/donjan/ETH/PhD/code/qmt/qmt/tasks/sweep.py", line 92, in run
return task._run()
File "/home/donjan/ETH/PhD/code/qmt/qmt/tasks/task.py", line 258, in _run
self.computed_result = self.delayed_result.calculate_futures(resources=self.resources)
File "/home/donjan/ETH/PhD/code/qmt/qmt/tasks/sweep.py", line 237, in calculate_futures
futures.append(self.dask_client.compute(delayed_result, resources=resources))
AttributeError: 'NoneType' object has no attribute 'compute'
Can you confirm that these snippets work for you?
from qmt.
Ah, I managed to break some stuff yesterday :) . It's fixed now. Yes, you should no longer use "self" in the _solve_instance methods, as they are static now to make it easier for Dask to work with them. Give it a try now; your snippet above now works for me.
from qmt.
Looks good now, everything works in Python3.
One QMS import left in qmt/geometry/freecad/run.py
, but I assume this is a conscious decision to keep the region mapping code in QMS.
I've added @staticmethod
to the _solve_instance
of Task derivatives currently in QMT, in accordance to the base class. (Python3 miraculously doesn't complain)
from qmt.
Related Issues (16)
- environment_min.yml is broken HOT 4
- sympy=1.0 requirement is blocking the upgrade to kwant 1.4 HOT 1
- tests only work when qmt is installed
- Pickle load error in QMT example notebook HOT 1
- Proposal assertion of units, in view of QMT/QMS refactor HOT 1
- Remove openBLAS dependency
- make the code PEP8 compliant HOT 9
- setup.py is broken HOT 6
- running setup.py doesn't create materials.json
- bug: qmt is imported in the source files HOT 5
- Fix build order in tasks HOT 5
- freecad_dict format HOT 6
- Bare asterisk signatures HOT 1
- test_geo_task broken HOT 6
- QMS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qmt.