Navigation Menu

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

Uncaught Exception in Operation Editor in dev.deepforge.org #1725

Open
umesh-timalsina opened this issue Jun 5, 2020 · 5 comments
Open

Uncaught Exception in Operation Editor in dev.deepforge.org #1725

umesh-timalsina opened this issue Jun 5, 2020 · 5 comments
Labels

Comments

@umesh-timalsina
Copy link
Contributor

Navigating from My Utilities to Operation Editor and changing its color or adding attributes throws the following error in dev.deepforge.org. The code becomes unreachable and any operation cannot be executed even after refresh. This behaviour also happens if there's any clipboard content pasted to the operation/ utilities code editor.

image

image

@umesh-timalsina
Copy link
Contributor Author

To be specific, in the server, the following error is thrown (if you refresh and try to execute the operation as is).

e:plugin:GenerateJob] Retrieving inputs and deserialize fns...
(node:1333) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getInputs' of undefined
    at GenerateJob.OperationOps.getInputs (/deepforge/src/common/plugin/Operation.js:32:36)
    at GenerateJob.createInputs (/deepforge/src/plugins/GenerateJob/GenerateJob.js:270:38)
    at GenerateJob.createOperationFiles (/deepforge/src/plugins/GenerateJob/GenerateJob.js:199:20)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async GenerateJob.main (/deepforge/src/plugins/GenerateJob/GenerateJob.js:96:23)

@brollb
Copy link
Contributor

brollb commented Jun 5, 2020

From the stack trace, it appears that no operation is found in the operation's code. Can you share the value of code here?

@umesh-timalsina
Copy link
Contributor Author

umesh-timalsina commented Jun 5, 2020

The value of the code there is as follows:

import math

import numpy as np

from matplotlib import pyplot as plt
from astropy.visualization import make_lupton_rgb

from utils.data_utils import DataSetSampler


class VisualizeRandomGalaxies():
    def __init__(self, num_galaxies=10):
        self.num_galaxies = num_galaxies


    def execute(self):
        # Execute your operation here!
        sampler = DataSetSampler()
        num_galaxies = self.num_galaxies
        cols = 2
        rows = math.ceil(self.num_galaxies / cols)
        
        sample_indices = np.random.choice(sampler.tgt_indices, 
                                          size=num_galaxies,
                                          replace=False)
        
        img_arr = sampler.cube[sample_indices]
        labels_arr = sampler.labels[sample_indices]
        
        assert img_arr.shape = (num_galaxies, 64, 64, 5)
        
        for j in range(num_galaxies):
            print(f'Galaxy: {labels_arr[j]["imageID"]},'
                  f'Redshift: labels_arr[j]["z"]')
                  
        fig, axes = plt.subplots(rows, cols)
        count = 0

@brollb
Copy link
Contributor

brollb commented Jun 5, 2020

It is failing because there is a syntax error here:

assert img_arr.shape = (num_galaxies, 64, 64, 5)

That said, it would be better for this to fail gracefully.

@brollb
Copy link
Contributor

brollb commented Jun 5, 2020

For example, a couple things that could be useful:

  • requiring the user to fix this issues before execution
  • integrate the code editor with a python language server or something similar

@umesh-timalsina umesh-timalsina mentioned this issue Jul 6, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants