Repository: pfnet/pytorch-pfn-extras

Issue:
Bug in when we use ProcessWriter with extensions.
## problem statement


I run a code that includes the below fragment. Then, the prompt throws the below error. 

```
    writer = writing.ProcessWriter(savefun=torch.save, out_dir=save_path)
    manager.extend(extensions.snapshot(writer=writer), trigger=(1, 'iteration'))
    manager.extend(extensions.snapshot(writer=writer, filename='gen_{.epoch}', target=generator.module), trigger=(10, 'iteration'))
    manager.extend(extensions.snapshot(), trigger=(10, 'epoch'))
    manager.extend(extensions.snapshot(filename='gen_{.epoch}', target=generator.module), trigger=(10, 'epoch'))    
```

## error message

```
Traceback (most recent call last):
  File "main_train.py", line 232, in <module>
    train()
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "main_train.py", line 226, in train
    Image.fromarray(x).save(f'{i}.png')
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 119, in __exit__
    next(self.gen)
  File "/usr/local/lib/python3.7/site-packages/pytorch_pfn_extras/training/manager.py", line 390, in run_iteration
    self.run_extensions()
  File "/usr/local/lib/python3.7/site-packages/pytorch_pfn_extras/training/manager.py", line 272, in run_extensions
    entry.extension(self)
  File "/usr/local/lib/python3.7/site-packages/pytorch_pfn_extras/training/extensions/_snapshot.py", line 397, in __call__
    self._make_snapshot(manager)
  File "/usr/local/lib/python3.7/site-packages/pytorch_pfn_extras/training/extensions/_snapshot.py", line 422, in _make_snapshot
    writer(filename, outdir, serialized_target, savefun=self._savefun)
  File "/usr/local/lib/python3.7/site-packages/pytorch_pfn_extras/writing.py", line 308, in __call__
    savefun, **self._kwds)
TypeError: create_worker() takes 4 positional arguments but 5 were given
```


The `create_worker` in StandardWriter accepts five arguments including `self`.
However, `create_worker` in ProccessWriter and ThreadWriter accept only four arguments. 


https://github.com/pfnet/pytorch-pfn-extras/blob/8b16df9433a024c63d786c76f1e7ccbb88847283/pytorch_pfn_extras/writing.py#L307-L312

https://github.com/pfnet/pytorch-pfn-extras/blob/8b16df9433a024c63d786c76f1e7ccbb88847283/pytorch_pfn_extras/writing.py#L374-L378


Discussion:

Resolving patch:
diff --git a/pytorch_pfn_extras/writing.py b/pytorch_pfn_extras/writing.py
--- a/pytorch_pfn_extras/writing.py
+++ b/pytorch_pfn_extras/writing.py
@@ -305,7 +305,7 @@ def __call__(self, filename, out_dir, target, *, savefun=None):
             self._started = False
         self._filename = filename
         self._worker = self.create_worker(filename, out_dir, target,
-                                          savefun, **self._kwds)
+                                          savefun=savefun, **self._kwds)
         self._worker.start()
         self._started = True
 


Test patch: