aiidalab / aiidalab-widgets-base

Reusable widgets for AiiDAlab applications
MIT License
6 stars 17 forks source link

ValueError: invalid port name `_source_structure`: cannot start with an underscore #581

Closed AndresOrtegaGuerrero closed 2 months ago

AndresOrtegaGuerrero commented 3 months ago

I am getting a error as a result of this line

https://github.com/aiidalab/aiidalab-widgets-base/blob/86681887f13a2838637d21f3d3293c2f5880c367/aiidalab_widgets_base/structures.py#L224

AttributeError Traceback (most recent call last) /opt/conda/lib/python3.9/site-packages/plumpy/processes.py in spec(cls) 181 try: --> 182 return cls.getattribute(cls, '_spec') 183 except AttributeError:

AttributeError: 'ProcessStateMachineMeta' object has no attribute '_spec'

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last) /opt/conda/lib/python3.9/site-packages/aiida/engine/processes/ports.py in validate_port_name(port_name) 232 try: --> 233 validate_link_label(port_name) 234 except ValueError as exception:

/opt/conda/lib/python3.9/site-packages/aiida/common/links.py in validate_link_label(link_label) 117 if linklabel.startswith(''): --> 118 raise ValueError('cannot start with an underscore') 119

ValueError: cannot start with an underscore

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last) ~/apps/quantum-espresso/src/aiidalabqe/app/structure/init.py in confirm(self, ) 162 163 def confirm(self, _=None): --> 164 self.manager.store_structure() 165 self.confirmed_structure = self.structure 166 self.message_area.value = ""

/opt/conda/lib/python3.9/site-packages/aiidalab_widgets_base/structures.py in storestructure(self, ) 224 return self.structure_node 225 --> 226 structure_node = user_modifications(self.input_structure) 227 228 else:

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/functions.py in decorated_function(*args, kwargs) 240 def decoratedfunction(*args, **kwargs): 241 """This wrapper function is the actual function that is called.""" --> 242 result, = run_get_node(*args, kwargs) 243 return result 244

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/functions.py in run_get_node(*args, *kwargs) 182 manager = get_manager() 183 runner = manager.get_runner() --> 184 inputs = process_class.create_inputs(args, **kwargs) 185 186 # Remove all the known inputs from the kwargs

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/functions.py in create_inputs(cls, *args, kwargs) 464 def create_inputs(cls, *args: t.Any, *kwargs: t.Any) -> dict[str, t.Any]: 465 """Create the input args for the FunctionProcess.""" --> 466 cls.validate_inputs(args, kwargs) 467 468 ins = {}

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/functions.py in validate_inputs(cls, *args, **kwargs) 457 # the input link to be completely lost. If the function supports variadic arguments, however, additional args 458 # should be accepted. --> 459 if cls.spec().inputs.dynamic and nargs > nparameters and not has_varargs: 460 name = cls._func.name 461 raise TypeError(f'{name}() takes {nparameters} positional arguments but {nargs} were given')

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/process.py in spec(cls) 86 @classmethod 87 def spec(cls) -> ProcessSpec: ---> 88 return super().spec() # type: ignore[return-value] 89 90 @classmethod

/opt/conda/lib/python3.9/site-packages/plumpy/processes.py in spec(cls) 185 cls._spec: ProcessSpec = cls._spec_class() # type: ignore 186 cls.__called: bool = False # type: ignore --> 187 cls.define(cls._spec) # type: ignore 188 assert cls.__called, ( 189 f'Process.define() was not called by {cls}\nHint: Did you forget to call the superclass method in '

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/functions.py in _define(cls, spec) 403 indirect_default = default 404 --> 405 spec.input( 406 parameter.name, 407 valid_type=valid_type,

/opt/conda/lib/python3.9/site-packages/plumpy/process_spec.py in input(self, name, kwargs) 130 :param kwargs: options for the input port 131 """ --> 132 self._create_port(self.inputs, self.INPUT_PORT_TYPE, name, kwargs) 133 134 def output(self, name: str, **kwargs: Any) -> None:

/opt/conda/lib/python3.9/site-packages/plumpy/process_spec.py in _create_port(self, port_namespace, port_class, name, kwargs) 121 port_namespace = port_namespace.create_port_namespace(namespace) 122 --> 123 port_namespace[port_name] = port_class(port_name, kwargs) 124 125 def input(self, name: str, **kwargs: Any) -> None:

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/ports.py in setitem(self, key, port) 199 raise TypeError('port needs to be an instance of Port') 200 --> 201 self.validate_port_name(key) 202 203 if hasattr(

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/ports.py in validate_port_name(port_name) 233 validate_link_label(port_name) 234 except ValueError as exception: --> 235 raise ValueError(f'invalid port name {port_name}: {exception}') 236 237 # Following regexes will match all groups of consecutive underscores where each group will be of the form

ValueError: invalid port name _source_structure: cannot start with an underscore

danielhollas commented 3 months ago

Which aiida-core version are you using ?

Dne so 6. 4. 2024 9:38 uživatel AndresOrtegaGuerrero < @.***> napsal:

I am getting a error as a result of this line

https://github.com/aiidalab/aiidalab-widgets-base/blob/86681887f13a2838637d21f3d3293c2f5880c367/aiidalab_widgets_base/structures.py#L224

AttributeError Traceback (most recent call last) /opt/conda/lib/python3.9/site-packages/plumpy/processes.py in spec(cls) 181 try: --> 182 return cls.getattribute(cls, '_spec') 183 except AttributeError:

AttributeError: 'ProcessStateMachineMeta' object has no attribute '_spec'

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last) /opt/conda/lib/python3.9/site-packages/aiida/engine/processes/ports.py in validate_port_name(port_name) 232 try: --> 233 validate_link_label(port_name) 234 except ValueError as exception:

/opt/conda/lib/python3.9/site-packages/aiida/common/links.py in validate_link_label(link_label) 117 if linklabel.startswith(''): --> 118 raise ValueError('cannot start with an underscore') 119

ValueError: cannot start with an underscore

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last) ~/apps/quantum-espresso/src/aiidalabqe/app/structure/init.py in confirm(self, ) 162 163 def confirm(self, _=None): --> 164 self.manager.store_structure() 165 self.confirmed_structure = self.structure 166 self.message_area.value = ""

/opt/conda/lib/python3.9/site-packages/aiidalab_widgets_base/structures.py in storestructure(self, ) 224 return self.structure_node 225 --> 226 structure_node = user_modifications(self.input_structure) 227 228 else:

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/functions.py in decorated_function(*args, kwargs) 240 def decoratedfunction(*args, **kwargs): 241 """This wrapper function is the actual function that is called.""" --> 242 result, = run_get_node(*args, kwargs) 243 return result 244

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/functions.py in run_get_node(*args, *kwargs) 182 manager = get_manager() 183 runner = manager.get_runner() --> 184 inputs = process_class.create_inputs(args, **kwargs) 185 186 # Remove all the known inputs from the kwargs

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/functions.py in create_inputs(cls, *args, kwargs) 464 def create_inputs(cls, *args: t.Any, *kwargs: t.Any) -> dict[str, t.Any]: 465 """Create the input args for the FunctionProcess.""" --> 466 cls.validate_inputs(args, kwargs) 467 468 ins = {}

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/functions.py in validate_inputs(cls, *args, *kwargs) 457 # the input link to be completely lost. If the function supports variadic arguments, however, additional args 458 # should be accepted. --> 459 if cls.spec().inputs.dynamic and nargs > nparameters and not has_varargs: 460 name = cls._func.name* 461 raise TypeError(f'{name}() takes {nparameters} positional arguments but {nargs} were given')

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/process.py in spec(cls) 86 @classmethod https://github.com/classmethod 87 def spec(cls) -> ProcessSpec: ---> 88 return super().spec() # type: ignore[return-value] 89 90 @classmethod https://github.com/classmethod

/opt/conda/lib/python3.9/site-packages/plumpy/processes.py in spec(cls) 185 cls._spec: ProcessSpec = cls._spec_class() # type: ignore 186 cls.__called: bool = False # type: ignore --> 187 cls.define(cls._spec) # type: ignore 188 assert cls.__called, ( 189 f'Process.define() was not called by {cls}\nHint: Did you forget to call the superclass method in '

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/functions.py in _define(cls, spec) 403 indirect_default = default 404 --> 405 spec.input( 406 parameter.name, 407 valid_type=valid_type,

/opt/conda/lib/python3.9/site-packages/plumpy/process_spec.py in input(self, name, kwargs) 130 :param kwargs: options for the input port 131 """ --> 132 self._create_port(self.inputs, self.INPUT_PORT_TYPE, name, kwargs) 133 134 def output(self, name: str, **kwargs: Any) -> None:

/opt/conda/lib/python3.9/site-packages/plumpy/process_spec.py in _create_port(self, port_namespace, port_class, name, kwargs) 121 port_namespace = port_namespace.create_port_namespace(namespace) 122 --> 123 port_namespace[port_name] = port_class(port_name, kwargs) 124 125 def input(self, name: str, **kwargs: Any) -> None:

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/ports.py in setitem(self, key, port) 199 raise TypeError('port needs to be an instance of Port') 200 --> 201 self.validate_port_name(key) 202 203 if hasattr(

/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/ports.py in validate_port_name(port_name) 233 validate_link_label(port_name) 234 except ValueError as exception: --> 235 raise ValueError(f'invalid port name {port_name}: {exception}') 236 237 # Following regexes will match all groups of consecutive underscores where each group will be of the form

ValueError: invalid port name _source_structure: cannot start with an underscore

— Reply to this email directly, view it on GitHub https://github.com/aiidalab/aiidalab-widgets-base/issues/581, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACIY64PG2PDQ2U2MJPKDY5DY36YBRAVCNFSM6AAAAABF2IV2F6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGIZDSMJUGUYDAMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

AndresOrtegaGuerrero commented 3 months ago

@danielhollas AiiDA v2.4.0.

danielhollas commented 3 months ago

Maybe try with the latest aiidalab image which should have 2.4.3

AndresOrtegaGuerrero commented 3 months ago

@danielhollas I am working on the container , but i dont want to update to affect, i will see if i can create another container to reproduce it. Thank you!

AndresOrtegaGuerrero commented 2 months ago

@danielhollas I tried with the latest aiida-core, and it also occurs , it will also create problems in some widgets in aiidalab_qe

danielhollas commented 2 months ago

Fixed in #597