Skip to content

Commit

Permalink
fix(executor): do not raise error but return none if no workspace (#3929
Browse files Browse the repository at this point in the history
)
  • Loading branch information
hanxiao committed Nov 14, 2021
1 parent bb44034 commit 5565b55
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions jina/executors/__init__.py
Expand Up @@ -199,11 +199,11 @@ def __call__(self, req_endpoint: str, **kwargs):
) # unbound method, self is required

@property
def workspace(self) -> str:
def workspace(self) -> Optional[str]:
"""
Get the path of the current shard.
Get the workspace directory of the Executor.
:return: returns the workspace of the shard of this Executor.
:return: returns the workspace of the current shard of this Executor.
"""
workspace = getattr(self.metas, 'workspace') or getattr(
self.runtime_args, 'workspace', None
Expand All @@ -223,11 +223,6 @@ def workspace(self) -> str:
if not os.path.exists(complete_workspace):
os.makedirs(complete_workspace)
return os.path.abspath(complete_workspace)
else:
raise ValueError(
'Neither `metas.workspace` nor `runtime_args.workspace` is set, '
'are you using this Executor in a Flow?'
)

def __enter__(self):
return self
Expand Down

0 comments on commit 5565b55

Please sign in to comment.