How to stop logging locally but only save to wandb's servers and have wandb work using soft links?
I am having a weird issue where I change the location of all my code &amp; data to a different location with more disk space, then I soft link my projects &amp; data to those locations with more space. I assume there must be some file handle issue because wandb's logger is throwing me issues. So my questions:

how do I have wandb only log  online and not locally? (e.g. stop trying to log anything to ./wandb[or any secret place it might be logging to]  since it's creating issues). Note my code was running fine after I  stopped logging to wandb so I assume that was the issue. note that the dir=None is the default to wandb's param.
how do I resolve this issue entirely so that it works seemlessly with all my projects softlinked somewhere else?


More details on the error
Traceback (most recent call last):
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/logging/__init__.py&quot;, line 1087, in emit
    self.flush()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/logging/__init__.py&quot;, line 1067, in flush
    self.stream.flush()
OSError: [Errno 116] Stale file handle
Call stack:
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/threading.py&quot;, line 930, in _bootstrap
    self._bootstrap_inner()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/threading.py&quot;, line 973, in _bootstrap_inner
    self.run()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/vendor/watchdog/observers/api.py&quot;, line 199, in run
    self.dispatch_events(self.event_queue, self.timeout)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/vendor/watchdog/observers/api.py&quot;, line 368, in dispatch_events
    handler.dispatch(event)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/vendor/watchdog/events.py&quot;, line 454, in dispatch
    _method_map[event_type](event)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/filesync/dir_watcher.py&quot;, line 275, in _on_file_created
    logger.info(&quot;file/dir created: %s&quot;, event.src_path)
Message: 'file/dir created: %s'
Arguments: ('/shared/rsaas/miranda9/diversity-for-predictive-success-of-meta-learning/wandb/run-20221023_170722-1tfzh49r/files/output.log',)
--- Logging error ---
Traceback (most recent call last):
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/logging/__init__.py&quot;, line 1087, in emit
    self.flush()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/logging/__init__.py&quot;, line 1067, in flush
    self.stream.flush()
OSError: [Errno 116] Stale file handle
Call stack:
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/threading.py&quot;, line 930, in _bootstrap
    self._bootstrap_inner()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/threading.py&quot;, line 973, in _bootstrap_inner
    self.run()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/internal/internal_util.py&quot;, line 50, in run
    self._run()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/internal/internal_util.py&quot;, line 101, in _run
    self._process(record)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/internal/internal.py&quot;, line 263, in _process
    self._hm.handle(record)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/internal/handler.py&quot;, line 130, in handle
    handler(record)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/internal/handler.py&quot;, line 138, in handle_request
    logger.debug(f&quot;handle_request: {request_type}&quot;)
Message: 'handle_request: stop_status'
Arguments: ()
N/A% (0 of 100000) |      | Elapsed Time: 0:00:00 | ETA:  --:--:-- |   0.0 s/it

Traceback (most recent call last):
  File &quot;/home/miranda9/diversity-for-predictive-success-of-meta-learning/div_src/diversity_src/experiment_mains/main_dist_maml_l2l.py&quot;, line 1814, in &lt;module&gt;
    main()
  File &quot;/home/miranda9/diversity-for-predictive-success-of-meta-learning/div_src/diversity_src/experiment_mains/main_dist_maml_l2l.py&quot;, line 1747, in main
    train(args=args)
  File &quot;/home/miranda9/diversity-for-predictive-success-of-meta-learning/div_src/diversity_src/experiment_mains/main_dist_maml_l2l.py&quot;, line 1794, in train
    meta_train_iterations_ala_l2l(args, args.agent, args.opt, args.scheduler)
  File &quot;/home/miranda9/ultimate-utils/ultimate-utils-proj-src/uutils/torch_uu/training/meta_training.py&quot;, line 167, in meta_train_iterations_ala_l2l
    log_zeroth_step(args, meta_learner)
  File &quot;/home/miranda9/ultimate-utils/ultimate-utils-proj-src/uutils/logging_uu/wandb_logging/meta_learning.py&quot;, line 92, in log_zeroth_step
    log_train_val_stats(args, args.it, step_name, train_loss, train_acc, training=True)
  File &quot;/home/miranda9/ultimate-utils/ultimate-utils-proj-src/uutils/logging_uu/wandb_logging/supervised_learning.py&quot;, line 55, in log_train_val_stats
    _log_train_val_stats(args=args,
  File &quot;/home/miranda9/ultimate-utils/ultimate-utils-proj-src/uutils/logging_uu/wandb_logging/supervised_learning.py&quot;, line 116, in _log_train_val_stats
    args.logger.log('\n')
  File &quot;/home/miranda9/ultimate-utils/ultimate-utils-proj-src/uutils/logger.py&quot;, line 89, in log
    print(msg, flush=flush)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/lib/redirect.py&quot;, line 640, in write
    self._old_write(data)
OSError: [Errno 116] Stale file handle
wandb: Waiting for W&amp;B process to finish... (failed 1). Press Control-C to abort syncing.
wandb: Synced vit_mi Adam_rfs_cifarfs Adam_cosine_scheduler_rfs_cifarfs 0.001: args.jobid=101161: https://wandb.ai/brando/entire-diversity-spectrum/runs/1tfzh49r
wandb: Synced 6 W&amp;B file(s), 0 media file(s), 0 artifact file(s) and 0 other file(s)
wandb: Find logs at: ./wandb/run-20221023_170722-1tfzh49r/logs
--- Logging error ---
Traceback (most recent call last):
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/interface/router_sock.py&quot;, line 27, in _read_message
    resp = self._sock_client.read_server_response(timeout=1)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/lib/sock_client.py&quot;, line 283, in read_server_response
    data = self._read_packet_bytes(timeout=timeout)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/lib/sock_client.py&quot;, line 269, in _read_packet_bytes
    raise SockClientClosedError()
wandb.sdk.lib.sock_client.SockClientClosedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/interface/router.py&quot;, line 70, in message_loop
    msg = self._read_message()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/interface/router_sock.py&quot;, line 29, in _read_message
    raise MessageRouterClosedError
wandb.sdk.interface.router.MessageRouterClosedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/logging/__init__.py&quot;, line 1087, in emit
    self.flush()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/logging/__init__.py&quot;, line 1067, in flush
    self.stream.flush()
OSError: [Errno 116] Stale file handle
Call stack:
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/threading.py&quot;, line 930, in _bootstrap
    self._bootstrap_inner()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/threading.py&quot;, line 973, in _bootstrap_inner
    self.run()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/threading.py&quot;, line 910, in run
    self._target(*self._args, **self._kwargs)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/interface/router.py&quot;, line 77, in message_loop
    logger.warning(&quot;message_loop has been closed&quot;)
Message: 'message_loop has been closed'
Arguments: ()
/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/tempfile.py:817: ResourceWarning: Implicitly cleaning up &lt;TemporaryDirectory '/srv/condor/execute/dir_27749/tmpmvf78q6owandb'&gt;
  _warnings.warn(warn_message, ResourceWarning)
/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/tempfile.py:817: ResourceWarning: Implicitly cleaning up &lt;TemporaryDirectory '/srv/condor/execute/dir_27749/tmpt5etqpw_wandb-artifacts'&gt;
  _warnings.warn(warn_message, ResourceWarning)
/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/tempfile.py:817: ResourceWarning: Implicitly cleaning up &lt;TemporaryDirectory '/srv/condor/execute/dir_27749/tmp55lzwviywandb-media'&gt;
  _warnings.warn(warn_message, ResourceWarning)
/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/tempfile.py:817: ResourceWarning: Implicitly cleaning up &lt;TemporaryDirectory '/srv/condor/execute/dir_27749/tmprmk7lnx4wandb-media'&gt;
  _warnings.warn(warn_message, ResourceWarning)


Error:
====&gt; about to start train loop
Starting training!
WARNING:urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)'))': /api/5288891/envelope/
--- Logging error ---
Traceback (most recent call last):
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/logging/__init__.py&quot;, line 1086, in emit
    stream.write(msg + self.terminator)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/wandb/sdk/lib/redirect.py&quot;, line 640, in write
    self._old_write(data)
OSError: [Errno 116] Stale file handle
Call stack:
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/threading.py&quot;, line 930, in _bootstrap
    self._bootstrap_inner()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/threading.py&quot;, line 973, in _bootstrap_inner
    self.run()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/threading.py&quot;, line 910, in run
    self._target(*self._args, **self._kwargs)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/sentry_sdk/worker.py&quot;, line 128, in _target
    callback()
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/sentry_sdk/transport.py&quot;, line 467, in send_envelope_wrapper
    self._send_envelope(envelope)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/sentry_sdk/transport.py&quot;, line 384, in _send_envelope
    self._send_request(
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/sentry_sdk/transport.py&quot;, line 230, in _send_request
    response = self._pool.request(
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/urllib3/request.py&quot;, line 78, in request
    return self.request_encode_body(
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/urllib3/request.py&quot;, line 170, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/urllib3/poolmanager.py&quot;, line 375, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File &quot;/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/urllib3/connectionpool.py&quot;, line 780, in urlopen
    log.warning(
Message: &quot;Retrying (%r) after connection broken by '%r': %s&quot;
Arguments: (Retry(total=2, connect=None, read=None, redirect=None, status=None), SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')), '/api/5288891/envelope/')


Bounty
My suggestions on what might solve this are:

Figuring out a way to stop wandb logging locally or minimize the amount of logging wandb is logging locally.
Figure out what is exactly being logged and minimize the space.
have the logging work even if all the folders are being symlinked. (imho this should work out of the box)
figuring out a systematic and simple way to find where the stale file handles are coming from.

I am surprised moving everything to /shared/rsaas/miranda9/ and running experiments from there did not solve the issue.

cross:

https://community.wandb.ai/t/how-to-stop-logging-locally-but-only-save-to-wandbs-servers-and-have-wandb-work-using-soft-links/3305
https://www.reddit.com/r/learnmachinelearning/comments/ybvo73/how_to_stop_logging_locally_but_only_save_to/
gitissue: https://github.com/wandb/wandb/issues/4409


seems like the solution is to not log to weird places with symlinks but log to real paths and instead clean up the wandb local paths often to avoid disk quota errors in your HPC. Not my fav solution but gets it done :).
Wandb should fix this, the whole point of wandb is that it works out of the box and I don't have to do MLOps and I can focus on research.
likely best to see discussions here: https://github.com/wandb/wandb/issues/4409
