Skip to content

Conversation

@nvincent-vossloh
Copy link
Contributor

description
Use ManagedFile to be able to pull file from resource, it is useful when a binary on the resource creates a file which needs to be accessible on the client side.
I tested this feature in my environment which uses labgrid.

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • Add a section on how to use the feature to doc/usage.rst
  • Add a section on how to use the feature to doc/development.rst
  • PR has been tested

I could need help regarding adding a test for this feature and which documentations files needs to be updated.

Thanks.

ManagedFile class now supports file download through
sync_from_resource() function.
Add a make_dist_folder() to create the target folder on the remote when
it does not exist to prevent failures from tools which require the
folder to exist.
rpath is now a property computed on the fly
File existence is now pushed back to sync_to_resource() because the
managed file may not exist (fetch case) when creating the instance.

Signed-off-by: Nicolas VINCENT <[email protected]>
@Emantor
Copy link
Member

Emantor commented Nov 13, 2023

Hi,

all drivers which created files on the exporter side so far took care of either opening a channel back to the client, i.e. via SSH and pipes or sync the requested data back automatically. I don't see why we need a generic mechanism which allows syncing files back to the client, the driver should already take care of that. This also extends the ManagedFile scope to be bidirectional.

@nvincent-vossloh
Copy link
Contributor Author

Hi,

all drivers which created files on the exporter side so far took care of either opening a channel back to the client, i.e. via SSH and pipes or sync the requested data back automatically. I don't see why we need a generic mechanism which allows syncing files back to the client, the driver should already take care of that. This also extends the ManagedFile scope to be bidirectional.

Hi,

Thanks for your reply, I may have misunderstood something.
My use case is a custom driver to manage st-link probe, I wish to dump the firmware on the MCU connected to the probe, therefore the file is created on the remote host by the probe and I want to get the dumped firmware to the client, in that sense it is more a fetch rather than a sync since the file was never on the client in the first place.

@Bastian-Krause
Copy link
Member

You could open the new file locally and make STM32_Programmer_CLI write to stdout and pass the file handle as stdout= in subprocess.Popen(). No need for any additional file transfer, no tmpfiles. See start_record() in #1157 as an example.

@nvincent-vossloh
Copy link
Contributor Author

You could open the new file locally and make STM32_Programmer_CLI write to stdout and pass the file handle as stdout= in subprocess.Popen(). No need for any additional file transfer, no tmpfiles. See start_record() in #1157 as an example.

Thank you for the tip, I will look into it and update this issue.

@Bastian-Krause Bastian-Krause added the needs author info Requires more information from the PR/Issue author label Dec 15, 2023
@Emantor
Copy link
Member

Emantor commented Dec 15, 2023

If you have additional questions or require feedback, either open a new PR or join the chat.

@Emantor Emantor closed this Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs author info Requires more information from the PR/Issue author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants